🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Strange .stabs bug in g++ 2.2.2

#207
From: Lupe Christoph
Date: Wed, 29 Jul 1992 23:04
92 lines
3154 bytes
I sent this bug report on 20. July. As I have not seen it in the newsgroup,
I take liberty to send it again. Apologies if I just missed it.

I have not seen this bug reported as here. Only the consequences
to libg++ when compiled in this way have been reported.

Environment:
	SPARCstation IPC
	SunOS 4.1.2 with ld-patch (100170-07)
	g++ 2.2.2 without gas (1.38)

Circumstances:
	I'm trying to get UITV2 (patchlevel 8) running with
	g++, as a shared library. I can't use gas, as it does
	not support PIC. UIT compiles PIC code with Sun's
	C++ compiler, both for the static and for the
	dynamic library.

Problem:
	g++ (not gcc) generates erroneous .stabs.
	These .stabs lead to undefined symbols.
	In this example it only happens	when doing static linking.
	In UIT it also happens when linking with the dynamic
	library.

Reproduce with:
	g++ -c -g -V 2.2.2-nogas c.cc
	g++ -static -o x -g -V 2.2.2-nogas c.o

Source (not preprocessed):
#include <stdarg.h>
 
void
x (char *msg, ...)
{
  va_list      ap;
  char        *arg;
  
  /* While the arg is not NULL... */
  while (arg) {
    /* Get the next argument from the  arg list */
    arg = va_arg (ap, char *);
  }
}

main()
{
    x("Hello, World!", 0);
}

Source (preprocessed, empty lines compressed):

# 1 "c.c"
# 1 "/usr/local/lib-sun4/g++-include/stdarg.h" 1 3
extern "C" {
# 1 "/usr/local/lib-sun4/gcc-lib/sun4-sunos4.1/2.2.2/include/stdarg.h" 1 3

# 1 "/usr/local/lib-sun4/gcc-lib/sun4-sunos4.1/2.2.2/include/va-sparc.h" 1

typedef char * __va___list;

# 65 "/usr/local/lib-sun4/gcc-lib/sun4-sunos4.1/2.2.2/include/va-sparc.h"
# 26 "/usr/local/lib-sun4/gcc-lib/sun4-sunos4.1/2.2.2/include/stdarg.h" 2 3

# 67 "/usr/local/lib-sun4/gcc-lib/sun4-sunos4.1/2.2.2/include/stdarg.h" 3

# 2 "/usr/local/lib-sun4/g++-include/stdarg.h" 2 3

}
# 1 "c.c" 2

void
x (char *msg, ...)
{
  __va___list       ap;
  char        *arg;
  
  while (arg) {
     
    arg = __extension__	({  char * __va_temp;	((__builtin_classify_type (__va_temp) >= 12)	? ((ap) += (((sizeof ( char * *) + sizeof (int) - 1) / sizeof (int)) * sizeof (int)) ,	**( char * **) ((ap) - (((sizeof ( char * *) + sizeof (int) - 1) / sizeof (int)) * sizeof (int)) ))	: (((sizeof ( char *) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))  == 8	? ({ union { char * d; int i[2];} u;	u.i[0] = ((int *) (ap))[0];	u.i[1] = ((int *) (ap))[1];	(ap) += 8;	u.d; })	: ((ap) += (((sizeof ( char *) + sizeof (

int) - 1) / sizeof (int)) * sizeof (int)) ,	*(( char * *) ((ap) - (((sizeof ( char *) + sizeof (int) - 1) / sizeof (int)) * sizeof (int)) ))));}) ;
  }
}

main()
{
    x("Hello, World!", 0);
}


----- End Included Message -----
Technical Details
Message-ID: <9207291904.AA00466@ukw.uucp>
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!cis.ohio-state.edu!ukw.UUCP!lupe

Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!usc!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!cis.ohio-state.edu!ukw.UUCP!lupe
From: lupe@ukw.UUCP (Lupe Christoph)
Subject: Strange .stabs bug in g++ 2.2.2
Message-ID: <9207291904.AA00466@ukw.uucp>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Wed, 29 Jul 1992 23:04:41 GMT
Approved: bug-g++@prep.ai.mit.edu
Lines: 92