ultrix 4.0 cc bug (serious -- varargs)

Reha Elci reha at cunixf.cc.columbia.edu
Sun Sep 23 03:55:47 AEST 1990


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



More information about the Comp.unix.ultrix mailing list