I did a cvs update, and it looks like imcc doesn't properly return integers anymore from nonprototyped routines. Or maybe it never did, and the switchover from nonprototype being the default to prototyped is what triggered it (because I had to add some explicit non_prototyped declarations, although I suspect they are incorrect.)
Test patch is attached, test case is: .pcc_sub _main $P0 = newsub _L_closure2 $I0 = 17 .pcc_begin non_prototyped .arg $I0 .pcc_call $P0 L_after_call7: .result $I1 .pcc_end after_call: print "returned " print $I1 print "\n" end .end .pcc_sub _L_closure2 non_prototyped .param int value .pcc_begin_return .return value .pcc_end_return .end
? imcc/tc Index: imcc/t/syn/pcc.t =================================================================== RCS file: /cvs/public/parrot/imcc/t/syn/pcc.t,v retrieving revision 1.31 diff -p -u -b -r1.31 pcc.t --- imcc/t/syn/pcc.t 20 Jan 2004 01:50:47 -0000 1.31 +++ imcc/t/syn/pcc.t 20 Jan 2004 01:58:28 -0000 @@ -1,6 +1,6 @@ #!perl use strict; -use TestCompiler tests => 34; +use TestCompiler tests => 36; ############################## # Parrot Calling Conventions @@ -96,6 +96,60 @@ CODE 10 20 30 +OUT + +output_is(<<'CODE', <<'OUT', "non-prototyped int return"); +.pcc_sub _main + $P0 = newsub _L_closure2 + $I0 = 17 + .pcc_begin non_prototyped + .arg $I0 + .pcc_call $P0 +L_after_call7: + .result $I1 + .pcc_end +after_call: + print "returned " + print $I1 + print "\n" + end +.end + +.pcc_sub _L_closure2 non_prototyped + .param int value + .pcc_begin_return + .return value + .pcc_end_return +.end +CODE +returned 17 +OUT + +output_is(<<'CODE', <<'OUT', "prototyped int return"); +.pcc_sub _main + $P0 = newsub _L_closure2 + $I0 = 17 + .pcc_begin prototyped + .arg $I0 + .pcc_call $P0 +L_after_call7: + .result $I1 + .pcc_end +after_call: + print "returned " + print $I1 + print "\n" + end +.end + +.pcc_sub _L_closure2 prototyped + .param int value + .pcc_begin_return + .return value + .pcc_end_return +.end +CODE +returned 17 OUT ##############################