# HG changeset patch # User Shinji KONO # Date 1290563418 -32400 # Node ID c3957d127e1708b654679486743c6b54f1f1de53 # Parent 56ba015b37ca1c933d3d460c0a203aa7374660ce minor fix diff -r 56ba015b37ca -r c3957d127e17 mc-parse.c --- a/mc-parse.c Tue Nov 23 23:05:08 2010 +0900 +++ b/mc-parse.c Wed Nov 24 10:50:18 2010 +0900 @@ -21,6 +21,11 @@ #include // #include // for malloc +// this in ./stdio.h +//extern void * malloc(size_t size); +//extern void * realloc(void *ptr, size_t size); + + #include "mc.h" #include "mc-parse.h" @@ -303,7 +308,7 @@ heapsize *= 2; if (HEAP_REPORT) fprintf(stderr,"** heap extended to %d\n",heapsize); - heap = (int*)realloc(heap,heapsize*sizeof(int)); + heap = (int*)realloc((void*)heap,heapsize*sizeof(int)); if(!heap) { error(MMERR); exit(1); } } set_lfree(heapsize); @@ -3854,7 +3859,7 @@ type = FLOAT; if (is_const(e)) { #if FLOAT_CODE - return (dcadr(e)>0.0) ? dcadr(e) : dlist2(FCONST,-dcadr(e)); + return (dcadr(e)>0.0) ? e : dlist2(FCONST,-dcadr(e)); #endif } return e; @@ -3869,7 +3874,7 @@ type = DOUBLE; if (is_const(e)) { #if FLOAT_CODE - return (dcadr(e)>0.0) ? dcadr(e) : dlist2(DCONST,-dcadr(e)); + return (dcadr(e)>0.0) ? e : dlist2(DCONST,-dcadr(e)); #endif } return e; diff -r 56ba015b37ca -r c3957d127e17 test/regargs.c --- a/test/regargs.c Tue Nov 23 23:05:08 2010 +0900 +++ b/test/regargs.c Wed Nov 24 10:50:18 2010 +0900 @@ -1,21 +1,93 @@ int printf(const char *format, ...); +extern unsigned long strlen(const char *s); + void arg1(int a1,int a2,int a3,int a4) { - printf("#0006:%d %d %d %d\n",a1,a2,a3,a4); + printf("#0008:%d %d %d %d\n",a1,a2,a3,a4); } void arg0(int a1,int a2,int a3,int a4) { arg1(0,1,2,3); - printf("#0013:%d %d %d %d\n",a1,a2,a3,a4); + printf("#0015:%d %d %d %d\n",a1,a2,a3,a4); +} + + +static int gcd(int i0,int j0) +{ + register int k,i=i0,j=j0; + if (iib? ia*3 : ia/4); + float fa =3, fb = 4; + printf("#0074:%f\n", fa*fb >fb? fa*3 : fa/4); + double ga =3, gb = 4; + printf("#0076:%g\n", ga*gb >gb? ga*3 : ga/4); + long long la =3, lb = 4; + printf("#0078:%lld\n", la*lb >lb? la*3 : la/4); +} + + int main() { arg0(0,1,2,3); + test_register(); + code_closing(); + return_value(); return 0; } + + diff -r 56ba015b37ca -r c3957d127e17 test/tstdarg.c --- a/test/tstdarg.c Tue Nov 23 23:05:08 2010 +0900 +++ b/test/tstdarg.c Wed Nov 24 10:50:18 2010 +0900 @@ -18,7 +18,7 @@ while((t= *numtypes++)) { if (t=='i') { i = va_arg(ap,int); - printf("#0021:int arg: %d\n",i); + printf("#0020:int arg: %d\n",i); #if 0 /* ‘float’ is promoted to ‘double’ when passed through ‘...’ */ } else if (t=='f') {