reha@cunixf.cc.columbia.edu (Reha Elci) (09/23/90)
For any routine that uses varargs as its input mechanism solely (that is va_alist as the only argument) and the first argument is a double varargs pulls bad value off of stack: getADouble(va_alist) va_dcl { va_list ap; double d; va_start(ap); d=va_arg(ap,double); va_end(ap); printf("got %lf\n",d); } main() { double d=3.122428374; printf("passing %lf\n",d); getADouble(d); } try this using cc -O0, -O1, -O2 and -O3. surprisingly the only one that works is the -O3!!! Anybody has a patch? Reha Elci
hartzell@boulder.Colorado.EDU (George Hartzell) (09/24/90)
In article <1990Sep22.175547.3963@cunixf.cc.columbia.edu>, reha@cunixf (Reha Elci) writes: > >For any routine that uses varargs as its input mechanism solely (that is >va_alist as the only argument) and the first argument is a double varargs >pulls bad value off of stack: This is an acknowledged problem on the real MIPS machines (RISC/os), so I guess that it carries over to the DEC RISC systems. Their only suggestion is to use the stdarg mechanism, which works, instead of varargs. g. George Hartzell (303) 492-4535 MCD Biology, University of Colorado-Boulder, Boulder, CO 80309 hartzell@Boulder.Colorado.EDU ..!ncar!boulder!hartzell