🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: [joost@ori.cadlab.de: seg-fault on contradicting prototypes, C++ & extern "C"]

#1155
From: Mike Stump
Date: Mon, 21 Dec 1992 21:57
73 lines
3347 bytes
This problem has been fixed, and should not exist in the next release of gcc.

> From: Michael Joosten <joost@ori.cadlab.de>
> Date: Wed, 1 Apr 92 21:22:03 +0200
> To: bug-gcc@prep.ai.mit.edu
> Reply-To: joost@cadlab.uni-paderborn.de

> Machine: sparc-sun-sunos41

> Compiled with: -O

> Version of cc1plus:
> >cc1plus -version
> GNU C++ version 2.1 (sparc) compiled by GNU C version 2.1.
> enabled: -fdefer-pop -fpeephole -ffunction-cse -fcommon -fgnu-linker
>          -mfpu -mepilogue

> Input File:
> > cat T.i

> int strcmp();

> extern "C" {
> int strcmp(const char*, const char*);
> }

> Arguments: cc1plus T.i

> Symptoms: Immediate Segmentation Violation. This also occurs in 2.0 and on
> sun3 (m68k-sun-sunos41).

> Gdb-4.4 says:
> (Sorry, no debugging info, it was way too large...)

> Program terminated with signal 11, Segmentation fault.
> Reading symbols from /usr/lib/libc.so.1.6...done.
> #0  0x32dc0 in common_type (t1=0x1800c0, t2=0x17fee8) at ../gcc-2.1/cp-typeck.c:312
> #1  0x32998 in commonparms (p1=0x180ad8, p2=0x17ff88) at ../gcc-2.1/cp-typeck.c:220
> #2  0x330f4 in common_type (t1=0x180af0, t2=0x180d60) at ../gcc-2.1/cp-typeck.c:378
> #3  0x1627c in duplicate_decls (newdecl=0x1947d8, olddecl=0x183030)
>     at ../gcc-2.1/cp-decl.c:2056
> #4  0x16fdc in pushdecl (x=0x1947d8) at ../gcc-2.1/cp-decl.c:2364
> #5  0x1d788 in start_decl (declarator=0x1787c8, declspecs=0x175548, initialized=0, 
>     raises=0x0) at ../gcc-2.1/cp-decl.c:4693
> #6  0xe360 in yyparse ()
> #7  0x87c64 in output_file_directive ()
> #8  0x8a74c in main ()

> The crash is here in cp-typecheck:common_type()

>     case POINTER_TYPE:
>     case REFERENCE_TYPE:
>       /* For two pointers, do this recursively on the target type,
> 	 and combine the qualifiers of the two types' targets.  */
>       {
> =>	tree target = common_type (TYPE_MAIN_VARIANT (TREE_TYPE (t1)),
> 				   TYPE_MAIN_VARIANT (TREE_TYPE (t2)));
> 	int constp

> Seems that the compare of the '()'  paramlist in t2 with the (const char*,
> const char*) hasn't checked 'comptypes' ?

> Hope that this little buggy is really easily reproducible 8-)

>  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> | Michael Joosten   |       Tel.  : (+49) (+) 5251-284 120                 |
> | CADLAB            |       Fax   : (+49) (+) 5251-284 140                 |
> | Bahnhofstr. 32    |       E-Mail: joost@cadlab.de                        |
> | D-4790 Paderborn  |        	    ...!uunet!unido!cadlab!joost           | 
> | FRG               | Mass mail to: joost@pbinfo.uni-paderborn.de          |
> |--------------------------------------------------------------------------|
> | CADLAB is a cooperation between Uni-GH Paderborn & SNI AG                |
>  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Technical Details
Message-ID: <9212212157.AA15282@cygnus.com>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!cygnus.com!mrs

Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!cygnus.com!mrs
From: mrs@cygnus.com (Mike Stump)
Subject: Re:  [joost@ori.cadlab.de: seg-fault on contradicting prototypes, C++ & extern "C"]
Message-ID: <9212212157.AA15282@cygnus.com>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Mon, 21 Dec 1992 21:57:25 GMT
Approved: bug-g++@prep.ai.mit.edu
Lines: 74