🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #809

Re: gcc 2.2.2 generates undefined symbols when using variable args and -g

#809
From: Mike Stump
Date: Sat, 29 Aug 1992 12:28
55 lines
2278 bytes
You might try gcc 2.2.1, as I think it does not have this problem.

> From: Schaefer - IP MGR <ip_mgr@asc.slb.com>
> Date: Fri, 7 Aug 92 21:10:02 CDT
> Message-Id: <9208080210.AA25815.ip_mgr@cesium.asc.slb.com>
> To: bug-gcc@prep.ai.mit.edu
> Cc: duttweiler@asc.slb.com, cwilliams@asc.slb.com

> 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.
Technical Details
Message-ID: <9208291228.AA28333@cygnus.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cygnus.com!mrs

Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!cis.ohio-state.edu!cygnus.com!mrs
From: mrs@cygnus.com (Mike Stump)
Subject: Re:  gcc 2.2.2 generates undefined symbols when using variable args and -g
Message-ID: <9208291228.AA28333@cygnus.com>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Sat, 29 Aug 1992 12:28:27 GMT
Approved: bug-g++@prep.ai.mit.edu
Lines: 56