[gnu.gcc.bug] gcc 1.31 sigsegv core dump Sun 3/160 SunOS 3.2

ian@sq.sq.com (Ian Darwin) (01/11/89)

[I sent this at the end of November but Watmath sat on it until
the end of December, then bounced it! -- ian]

Gcc gets a sigsegv in cc1 when run with -O, compiles OK without -O.
Running 1.31 on a Sun-3.

Thanks to Mark Brader for isolating this out of a 90K source file.

Script started on Wed Nov 30 08:36:20 1988
sq% gcc -v -c id.c
gcc version 1.31
 /usr/local/lib/gcc-cpp -v -undef -D__GNU__ -D__GNUC__ -Dmc68000 -Dsun -Dunix -D__HAVE_68881__ -Dmc68020 id.c /tmp/cca02810.cpp
GNU CPP version 1.31
 /usr/local/lib/gcc-cc1 /tmp/cca02810.cpp -quiet -dumpbase id.c -version -o /tmp/cca02810.s
GNU C version 1.31 (68k, MIT syntax) compiled by GNU C version 1.31.
 /usr/local/lib/gcc-as -mc68020 /tmp/cca02810.s -o id.o
sq% size id.o
text    data    bss     dec     hex
28      0       0       28      1c
sq% gcc -v -c -O id.c
gcc version 1.31
 /usr/local/lib/gcc-cpp -v -undef -D__GNU__ -D__GNUC__ -Dmc68000 -Dsun -Dunix -D__OPTIMIZE__ -D__HAVE_68881__ -Dmc68020 id.c /tmp/cca02836.cpp
GNU CPP version 1.31
 /usr/local/lib/gcc-cc1 /tmp/cca02836.cpp -quiet -dumpbase id.c -O -version -o /tmp/cca02836.s
GNU C version 1.31 (68k, MIT syntax) compiled by GNU C version 1.31.
gcc: Program cc1 got fatal signal 11.
sq% gdb+ /usr/local/lib/gcc-cc1 core
GDB 2.5.4 (GNU C++ 1.22.0 compatible), Copyright (C) 1988 Free Software Foundation, Inc.
There is ABSOLUTELY NO WARRANTY for GDB; type "info warranty" for details.
GDB is free software and you are welcome to distribute copies of it
 under certain conditions; type "info copying" to see the conditions.
Reading symbol data from /usr/local/lib/gcc-cc1...done.
Core file is from "gcc-cc1".
Program terminated with signal 11, Segmentation fault.
Type "help" for a list of commands.
(gdb+) where
#0  0x37c48 in equiv_constant (x=(rtx) 0x8d450) (cse.c line 2328)
#1  0x3726a in fold_rtx (x=(rtx) 0x8d4f4, copyflag=0) (cse.c line 1792)
#2  0x38220 in cse_insn (insn=(rtx) 0x8d4c0) (cse.c line 2725)
#3  0x39076 in cse_basic_block (from=(rtx) 0x8d04c, to=(rtx) 0x0) (cse.c line 3461)
#4  0x38fc8 in cse_main (f=(rtx) 0x8d04c, nregs=60) (cse.c line 3427)
#5  0x34d4 in rest_of_compilation (decl=(tree) 0x8f4e4) (toplev.c line 1191)
#6  0x1257a in finish_function () (c-decl.c line 3328)
#7  0x7b28 in yyparse () (c-parse.y line 243)
#8  0x2f08 in compile_file (name=(char *) 0xefffb84 "/tmp/cca02836.cpp") (toplev.c line 914)
#9  0x428c in main (argc=9, argv=(char **) 0xefffa98, envp=(char **) 0xefffac0) (toplev.c line 1636)
(gdb+) p (rtx)0x8d450
$1 = (rtx) 0x8d450
(gdb+) p x
$2 = (rtx) 0x8d450
(gdb+) p *x
$3 = {code = SUBREG, mode = HImode, jump = 0, call = 0, unchanging = 0, volatil = 0, in_struct = 0, used = 1, integrated = 0, fld = {{rtint = 578328, rtstr = 0x8d318 "", rtx = 0x8d318, rtvec = 0x8d318, rttype = 578328}}}
(gdb+) quit
sq% 
sq% ^D
script done on Wed Nov 30 08:44:20 1988

Here is the minimum test case that causes this failure.
Removing either of the two assignments makes the failure go away.
Compiling with -Wall only complains that main is defaulted to int.

: To unbundle, sh this file
echo x - id.c 1>&2
cat >id.c <<'@@@End of id.c'
/*
 * The following causes gcc -O to dump core, but not gcc without -O.
 * Compiles on numerous other C compilers.
 * Isolated by Mark Brader and Ian Darwin, SoftQuad Inc.
 */

main()
{
	union {
		struct { unsigned short a, b; } c;
		long d;
	} e, *f;

	int g;

	g = e.c.b;
	f = &e;
}
@@@End of id.c

Ian Darwin
ian@sq.com
utzoo!sq!ian




------- End of Forwarded Message