Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uunet!wuarchive!zaphod.mps.ohio-state.edu!uwm.edu!rutgers!cunixf.cc.columbia.edu!reha From: reha@cunixf.cc.columbia.edu (Reha Elci) Newsgroups: comp.unix.ultrix Subject: ultrix 4.0 cc bug (serious -- varargs) Summary: varargs does not work in one case Keywords: varargs double cc mips compiler Message-ID: <1990Sep22.175547.3963@cunixf.cc.columbia.edu> Date: 22 Sep 90 17:55:47 GMT Distribution: usa Organization: Columbia University Lines: 31 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