This is the mail archive of the mailing list for the GCC project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

optimization/9775: -O3 complains about stdarg functions

>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
>Originator:     Michael van Elst
>Release:        gcc-3.2.2
FreeBSD 4.7-STABLE FreeBSD 4.7-STABLE #0: Fri Oct 11 18:32:25 CEST 2002     root at dt4 dot dev dot de dot cw dot 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

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;

    while (c > 0) {
        a = va_arg(ap, int);
        c += a;
    return s;

int bar(void)
    return foo(4,1,2,3,4) + foo(2,9,5);
see above. The same happens with gcc-3.2.1 but not with gcc-2.95.4


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]