I noticed this when trying to build mpg123 on NetBSD/sparc64. Matthew Green and I reduced it to a small example code: Store this in test.c: --8<-- typedef char * va_list; void generic_sendmsg (char *fmt, ...) { va_list ap; (void)(__builtin_next_arg(fmt), (ap) = (va_list)__builtin_saveregs()); } void generic_sendstat() { double t; generic_sendmsg("F %3.2f", t); } -->8-- Then try: $ cc -c -O3 test.c test.c: In function `generic_sendstat': test.c:7: error: `va_start' used in function with fixed args $ But: $ cc -c -O3 -fno-inline test.c $ The problem does not happen for non-sparc targets (AFAICT)
Is this a regression?
gcc 3.2.3 as Reading specs from /work/gcc323/lib/gcc-lib/sparc64--netbsd/3.2.3/specs Configured with: ../gcc/configure --prefix=/work/gcc323 --enable-languages=c,c++,objc --enable-nls=no --disable-shared sparc64--netbsd Thread model: single gcc version 3.2.3 also gives the same result $ /work/gcc323/bin/gcc -c -O3 vatest.c vatest.c: In function `generic_sendstat': vatest.c:7: `va_start' used in function with fixed args
Confirmed on i586-redhat-linux-gnu as of 3.3.2 20030904 (prerelease) with: void generic_sendmsg (char *fmt, ...) { __builtin_next_arg(fmt); } void generic_sendstat() { double t; generic_sendmsg("F %3.2f", t); } % gcc-3.3.2 -O3 pr12180.c pr12180.c: In function `generic_sendstat': pr12180.c:5: error: `va_start' used in function with fixed args This is a regression from GCC 3.0.4.
Subject: Bug 12180 CVSROOT: /cvs/gcc Module name: gcc Changes by: mmitchel@gcc.gnu.org 2003-10-03 00:23:30 Modified files: gcc : ChangeLog tree-inline.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/gcc.dg: 20031002-1.c Log message: PR optimization/12180 * tree-inline.c (inline_forbidden_p_1): Do not permit inlining of functions containing calls to PR optimization/12180 * gcc.dg/20031002-1.c: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.1263&r2=2.1264 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/tree-inline.c.diff?cvsroot=gcc&r1=1.81&r2=1.82 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3092&r2=1.3093 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/20031002-1.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
Subject: Bug 12180 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_3-branch Changes by: mmitchel@gcc.gnu.org 2003-10-03 00:36:57 Modified files: gcc : ChangeLog c-objc-common.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/gcc.dg: 20031002-1.c Log message: PR optimization/12180 * tree-inline.c (inline_forbidden_p_1): Do not permit inlining of functions containing calls to PR optimization/12180 * gcc.dg/20031002-1.c: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.16114.2.765&r2=1.16114.2.766 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-objc-common.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.18.4.1&r2=1.18.4.2 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.2261.2.294&r2=1.2261.2.295 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/20031002-1.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.2.2.1
Fixed in 3.3.2 and the mainline.