🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gcc.bug
Article #698

gcc 1.36 (cc1) fatal error

#698
From: Dave Cornelius
Date: Wed, 11 Oct 1989 01:08
101 lines
3640 bytes
The enclosed program causes gcc-1.36 to die with a fatal signal (11: SIGSEGV)
when the '-traditional' command line argument is given.  (Omitting
the '-traditional' allows the compilation to take place :-).

Environment:
 - Sun 4/260(sunos4.0.3) or Sun 3/150(sunos3.5)
 - 'cc' on that machine
 - config.h -> config/xm-sparc.h (or config/xm-m68k.h for the sun3/150)
 - aux-output.c -> config/out-m68k.c
 - md -> config/m68k.md
 - tm.h -> config/tm-sun3.h

Command line args:  -traditional

Cursory analysis (and some guesswork):

Building the trees for the embedded structure declarations causes
build_int to be invoked for the integers which are the sizes of
each of the structs.  build_int caches the constant trees built therein
via its static size_table.

At the end of the procedure block, something happens to these constant
blocks, such that the cached pointer is no longer valid.  Subsequent
calls to build_int find a cached entry, which is no longer valid.

I turned off the caching in build_int, and the crash does not occur.
I have no idea how awful the performance implications of disabling
this cache are :-(  ( It must have been thought to be important at some
point in time :-)!

Perhaps the trees need reference counts, and the destruction routines
can watch the ref count go to zero, and nuke the cache pointer if
the tree is really free?

I hope this helps isolate the problem and generate a fix; we'll
continue to operate with the cache turned off.
If there's any other info I can provide, do drop me a line!

We continue to be impressed with the quality of the gnu compiler!

	Yours,
-----------
Dave Cornelius				Network Computing Devices
					350 North Bernardo Ave
{uunet,ardent,mips}!lupine!dc		Mountain View, CA, 94043
 OR: dc@ncd.com				415-694-0675


================================
dbx session output:

dc@sheridan 189> dbx /u4/gnu/gcc-1.36/sun4/sun3/cc1
Reading symbolic information...
Read 49226 symbols

(dbx) run t.c -traditional

Running: /u4/gnu/gcc-1.36/sun4/sun3/cc1 t.c -traditional
 p1 p2 p3signal SEGV (segmentation violation) in expand_expr at line 2161 in file "gnu/gcc-1.36/expr.c"
2161     register enum machine_mode mode = TYPE_MODE (type);

(dbx) where

expand_expr(exp = 0x103400, target = (nil), tmode = VOIDmode,      \
	modifier = EXPAND_NORMAL), line 2161 in "gnu/gcc-1.36/expr.c"
variable_size(size = 0x103400), line 161 in "gnu/gcc-1.36/stor-layout.c"
layout_type(type = 0x103380), line 929 in "gnu/gcc-1.36/stor-layout.c"
finish_struct(t = 0x103380, fieldlist = 0x10ccb8),                 \
	line 3205 in "gnu/gcc-1.36/c-decl.c"
yyparse(), line 768 in "/gp/rms/cc/c-parse.y"
compile_file(name = 0xf7fff9eb "t.c"), line 1118 in "gnu/gcc-1.36/toplev.c"
main(argc = 3, argv = 0xf7fff96c, envp = 0xf7fff97c),              \
	line 1991 in "gnu/gcc-1.36/toplev.c"
(dbx)

============= t.c ============
int foo;

p1()
{
	struct overlay1 {
		int	i;
		char	*p;
		unsigned count;
	} *ovp = (struct overlay1 *)foo;
}

p2()
{
	struct overlay2 {
	} *ovp = (struct overlay2 *)foo;
}

p3()
{
	struct overlay3 {
		char	*p;
		int	i;
		unsigned count;
	} *ovp = (struct overlay3 *)foo;
}
Technical Details
Message-ID: <8910110108.AA24397@lupine.ncd.com>
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!gem.mps.ohio-state.edu!tut.cis.ohio-state.edu!UUNET.UU.NET!lupine!dc

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!apple!gem.mps.ohio-state.edu!tut.cis.ohio-state.edu!UUNET.UU.NET!lupine!dc
From: lupine!dc@UUNET.UU.NET (Dave Cornelius)
Newsgroups: gnu.gcc.bug
Subject: gcc 1.36 (cc1) fatal error
Message-ID: <8910110108.AA24397@lupine.ncd.com>
Date: 11 Oct 89 01:08:10 GMT
Sender: daemon@tut.cis.ohio-state.edu
Distribution: gnu
Organization: GNUs Not Usenet
Lines: 101