Thread View: gnu.gcc.bug
1 messages
1 total messages
Started by Schaefer - IP MGR
Sat, 08 Aug 1992 02:10
gcc 2.2.2 generates undefined symbols when using variable args and -g
Author: 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%
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads