optimization/9775: -O3 complains about stdarg functions
mlelstv@dev.de.cw.net
mlelstv@dev.de.cw.net
Thu Feb 20 16:06:00 GMT 2003
>Number: 9775
>Category: optimization
>Synopsis: -O3 complains about stdarg functions
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Feb 20 16:06:01 UTC 2003
>Closed-Date:
>Last-Modified:
>Originator: Michael van Elst
>Release: gcc-3.2.2
>Organization:
>Environment:
FreeBSD dt4.dev.de.cw.net 4.7-STABLE FreeBSD 4.7-STABLE #0: Fri Oct 11 18:32:25 CEST 2002 root@dt4.dev.de.cw.net:/usr/src/sys/compile/DT4 i386
Reading specs from /cw/lib/gcc-lib/i386-unknown-freebsd4.7/3.2.2/specs
Configured with: ../configure --prefix=/cw --exec-prefix=/cw --includedir=/cw/include/gcc --with-gxx-include-dir=/cw/include/g++ --with-local-prefix=/cw/lib/gcc-lib --enable-languages=c,c++ --enable-threads=posix --disable-maintainer-mode --disable-shared --disable-nls --with-gnu-as --with-gnu-ld
Thread model: posix
gcc version 3.2.2
>Description:
gcc does not compile the following source with -O3, smaller optimization levels do work fine. The error reported is:
% gcc -O3 -c c.c
c.c: In function `bar':
c.c:8: `va_start' used in function with fixed args
c.c:8: `va_start' used in function with fixed args
-- snip --
#include <stdarg.h>
int foo(int c, ...)
{
va_list ap;
int a, s=0;
va_start(ap,c);
while (c > 0) {
a = va_arg(ap, int);
c += a;
}
va_end(ap);
return s;
}
int bar(void)
{
return foo(4,1,2,3,4) + foo(2,9,5);
}
>How-To-Repeat:
see above. The same happens with gcc-3.2.1 but not with gcc-2.95.4
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list