Article View: gnu.gcc.bug
Article #319gcc 2.2.2 generates undefined symbols when using variable args and -g
From: Schaefer - IP MGR
Date: Sat, 08 Aug 1992 02:10
Date: Sat, 08 Aug 1992 02:10
48 lines
1934 bytes
1934 bytes
Is the following a bug or do I need some compiler directive to use
"varargs" from c++ code ?
The version of stdarg.h is from the gcc distribution kit.
The following code when compiled with gcc 2.2.2 (This is a .cc file)
generates undefined for branch labels
#include <stdarg.h>
extern "C" {
void test(int stat, ...)
{
va_list ap;
int key;
va_start(ap, stat);
while (key = va_arg(ap, int)) {
printf("Key is %d \n", key);
}
va_end(ap);
}
}
cesium% !gcc
gcc -v -g -c -DGCC -DSUN -DSUN4 -DUNIX -o foo.o foo.cc
Reading specs from /usr/local/gcc-2.2/lib/gcc-lib/sparc-sun-sunos4.1/2.2.2/specs
gcc version 2.2.2
/usr/local/gcc-2.2/lib/gcc-lib/sparc-sun-sunos4.1/2.2.2/cpp -lang-c++ -v -DGCC -DSUN -DSUN4 -DUNIX -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dsparc -Dsun -Dunix -D__sparc__ -D__sun__ -D__unix__ -D__sparc -D__sun -D__unix -g foo.cc /tmp/cca25800.i
GNU CPP version 2.2.2 (sparc)
/usr/local/gcc-2.2/lib/gcc-lib/sparc-sun-sunos4.1/2.2.2/cc1plus /tmp/cca25800.i -fno-builtin -quiet -dumpbase foo.cc -g -version -o /tmp/cca25800.s
GNU C++ version 2.2.2 (sparc) compiled by GNU C version 2.2.2.
foo.cc: In function `void test (int, ...)':
foo.cc:12: warning: implicit declaration of function `printf'
as -o foo.o /tmp/cca25800.s
cesium% !nm
nm foo.o
U LBB5
U LBE5
U ___builtin_saveregs
U _printf
0000000c T _test
00000000 t gcc2_compiled.
cesium%
Technical Details
Message-ID:
<9208080210.AA25815.ip_mgr@cesium.asc.slb.com>Path:
arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!asc.slb.com!ip_mgrShow Full Headers
Complete Article Headers
Newsgroups: gnu.gcc.bug Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!asc.slb.com!ip_mgr From: ip_mgr@asc.slb.com (Schaefer - IP MGR) Subject: gcc 2.2.2 generates undefined symbols when using variable args and -g Message-ID: <9208080210.AA25815.ip_mgr@cesium.asc.slb.com> Sender: gnulists@ai.mit.edu Organization: GNUs Not Usenet Distribution: gnu Date: Sat, 8 Aug 1992 02:10:02 GMT Approved: bug-gcc@prep.ai.mit.edu Lines: 49