Bug 7353 - Compiler dies on known working code (as of gcc 3.0)
Summary: Compiler dies on known working code (as of gcc 3.0)
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: c (show other bugs)
Version: 3.1
: P1 critical
Target Milestone: 3.1.x/3.2.x
Assignee: Zack Weinberg
URL: https://gcc.gnu.org/pipermail/gcc-pat...
Keywords: ice-on-valid-code
Depends on:
Blocks:
 
Reported: 2002-07-18 14:26 UTC by mike
Modified: 2021-12-07 01:36 UTC (History)
2 users (show)

See Also:
Host: i686-pc-linux-gnu
Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu
Known to work:
Known to fail:
Last reconfirmed:


Attachments
act.informative.i.gz (60.95 KB, application/x-gzip )
2003-05-21 15:16 UTC, mike
Details

Note You need to log in before you can comment on or make changes to this bug.
Description mike 2002-07-18 14:26:00 UTC
Freshly installed version 3.1.  Tried compiling a program that compiles and runs fine with
3.0 and 2.95.3 (as well as other compilers on other OS's and architectures) and it dies
with an internal compiler error.

Here's a cut-n-paste of the output.

$ make
gcc -c -g -Wall -O2 -Ih -D_GNU_SOURCE -std=gnu99 -Wunused -Wunreachable-code -v -save-temps  act.informative.c -o o/act.informative.o
Reading specs from /usr/lib/gcc-lib/i686-pc-linux-gnu/3.1/specs
Configured with: ./configure --prefix=/usr
Thread model: single
gcc version 3.1
 /usr/lib/gcc-lib/i686-pc-linux-gnu/3.1/cpp0 -lang-c -v -Ih -D__GNUC__=3 -D__GNUC_MINOR__=1 -D__GNUC_PATCHLEVEL__=0 -D__ELF__ -Dunix -D__gnu_linux__ -Dlinux -D__ELF__ -D__unix__ -D__gnu_linux__ -D__linux__ -D__unix -D__linux -Asystem=posix -D__OPTIMIZE__ -D__STDC_HOSTED__=1 -Acpu=i386 -Amachine=i386 -Di386 -D__i386 -D__i386__ -D__tune_i686__ -D__tune_pentiumpro__ -D_GNU_SOURCE act.informative.c -std=gnu99 -Wall -Wunused -Wunreachable-code act.informative.i
GNU CPP version 3.1 (cpplib) (i386 Linux/ELF)
ignoring nonexistent directory "/usr/i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 h
 /usr/local/include
 /usr/lib/gcc-lib/i686-pc-linux-gnu/3.1/include
 /usr/include
End of search list.
 /usr/lib/gcc-lib/i686-pc-linux-gnu/3.1/cc1 -fpreprocessed act.informative.i -quiet -dumpbase act.informative.c -g -O2 -Wall -Wunused -Wunreachable-code -std=gnu99 -version -o act.informative.s
GNU CPP version 3.1 (cpplib) (i386 Linux/ELF)
GNU C version 3.1 (i686-pc-linux-gnu)
	compiled by GNU C version 3.2 20020718 (experimental).
act.informative.c: In function `show_obj_to_char':
act.informative.c:127: warning: will never be executed
act.informative.c: In function `look_at_char':
act.informative.c:285: warning: will never be executed
act.informative.c:285: warning: will never be executed
act.informative.c: In function `do_auto_exits':
act.informative.c:542: warning: will never be executed
act.informative.c: In function `do_look':
act.informative.c:854: warning: will never be executed
act.informative.c: In function `do_help':
act.informative.c:1321: warning: will never be executed
act.informative.c:1375: warning: will never be executed
act.informative.c:1320: warning: will never be executed
act.informative.c:1374: warning: will never be executed
act.informative.c: In function `do_who':
act.informative.c:1480: warning: will never be executed
act.informative.c:1506: warning: will never be executed
act.informative.c: In function `do_users':
act.informative.c:1657: warning: will never be executed
act.informative.c:1690: warning: will never be executed
/usr/include/bits/string2.h:424: warning: will never be executed
/usr/include/bits/string2.h:427: warning: will never be executed
/usr/include/bits/string2.h:432: warning: will never be executed
/usr/include/bits/string2.h:435: warning: will never be executed
/usr/include/bits/string2.h:440: warning: will never be executed
/usr/include/bits/string2.h:445: warning: will never be executed
/usr/include/bits/string2.h:452: warning: will never be executed
act.informative.c: In function `perform_mortal_where':
act.informative.c:1804: warning: will never be executed
act.informative.c:1816: warning: will never be executed
act.informative.c:1819: warning: will never be executed
act.informative.c: In function `do_consider':
act.informative.c:2100: warning: will never be executed
act.informative.c:2051: warning: will never be executed
act.informative.c: In function `do_diagnose':
act.informative.c:2116: warning: will never be executed
act.informative.c: In function `do_toggle':
/usr/include/bits/string2.h:421: warning: will never be executed
/usr/include/bits/string2.h:424: warning: will never be executed
/usr/include/bits/string2.h:427: warning: will never be executed
/usr/include/bits/string2.h:435: warning: will never be executed
/usr/include/bits/string2.h:440: warning: will never be executed
/usr/include/bits/string2.h:445: warning: will never be executed
/usr/include/bits/string2.h:452: warning: will never be executed
act.informative.c: In function `scan_rooms':
act.informative.c:2493: warning: will never be executed
act.informative.c:2544: warning: will never be executed
act.informative.c:2561: warning: will never be executed
act.informative.c:2612: warning: will never be executed
act.informative.c:2621: Internal compiler error in gen_typedef_die, at dwarf2out.c:11035
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.
make: *** [o/act.informative.o] Error 1

Release:
3.1

Environment:
System: Linux velgarian.sytes.net 2.4.18 #1 Sun Jul 7 10:39:30 EDT 2002 i686 unknown
Architecture: i686

	
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ./configure --prefix=/usr
Comment 1 mike 2002-07-18 14:26:00 UTC
Fix:
unknown. tried various flags, options, all died in the same way at the same place.
Comment 2 Volker Reichelt 2002-07-19 18:54:36 UTC
From: Reichelt <reichelt@igpm.rwth-aachen.de>
To: gcc-gnats@gcc.gnu.org, mike@velgarian.sytes.net, gcc-bugs@gcc.gnu.org,
        nobody@gcc.gnu.org
Cc:  
Subject: Re: c/7353: Compiler dies on known working code (as of gcc 3.0)
Date: Fri, 19 Jul 2002 18:54:36 +0200

 Hi,
 
 the ICE is caused by the code in line 2450 and line 2463 of
 act.informative.c (lines 10398 and 10411 of the preprocessed file).
 If you replace the right hand sides of the = operator by something
 else, the code compiles fine.
 
 The offending code can be reduced to
 
 --------------------------snip here-------------------------
 typedef A = 0;
 --------------------------snip here-------------------------
 
 which will cause an ICE if compiled with gcc 3.1 or the main trunk
 as of 20020715 (checked on i686-pc-linux-gnu and mips-sgi-irix6.5).
 
 IMHO the code is illegal. Since it was accepted by earlier versons of
 the compiler there seems to be an accepts-illegal bug for gcc 2.95.x
 3.0.x.
 
 Greetings,
 Volker Reichelt
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7353
 
 

Comment 3 Volker Reichelt 2002-08-28 17:33:55 UTC
From: Reichelt <reichelt@igpm.rwth-aachen.de>
To: gcc-gnats@gcc.gnu.org, mike@velgarian.sytes.net, gcc-bugs@gcc.gnu.org,
        nobody@gcc.gnu.org
Cc:  
Subject: Re: c/7353: Compiler dies on known working code (as of gcc 3.0)
Date: Wed, 28 Aug 2002 17:33:55 +0200

 Hi again,
 
 sorry, I wasn't aware that "typedef A = 0;" is a valid gcc extension.
 So, your code was in fact valid (although only for gcc) and the bug is an
 ice-on-legal-code for 3.1.x, 3.2 and the main trunk (3.3 20020816).
 Because it's a regression, it should be marked high priority.
 
 BTW, for the code "typedef A = 0;" the error message is
 
 bug.c:1: Internal compiler error in make_decl_rtl, at varasm.c:839
 Please submit a full bug report, [etc.]
 
 For "void foo () { typedef A = 0; }" I get
 
 bug.c:1: Internal compiler error in gen_typedef_die, at dwarf2out.c:11035
 Please submit a full bug report, [etc.]
 
 instead (if I compile the code with "-g" enabled).
 
 Greetings,
 Volker Reichelt
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=7353
 
 
Comment 4 Zack Weinberg 2002-10-07 23:13:06 UTC
Responsible-Changed-From-To: unassigned->zack
Responsible-Changed-Why: Working on a fix.
Comment 5 Zack Weinberg 2002-10-07 23:13:06 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: See http://gcc.gnu.org/ml/gcc-patches/2002-10/msg00411.html
Comment 6 Zack Weinberg 2002-10-09 14:53:18 UTC
State-Changed-From-To: analyzed->closed
State-Changed-Why: Patch has been committed to 3.2 and 3.3 to address this bug.
    I'm afraid you may not be happy with it; our solution was to
    remove this extension.  You can convert your code easily to
    use the still-supported 'typeof' extension, however; see the
    release notes (http://gcc.gnu.org/gcc-3.2/changes.html)
Comment 7 Zack Weinberg 2002-10-09 21:31:04 UTC
From: zack@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c/7353
Date: 9 Oct 2002 21:31:04 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Branch: 	gcc-3_2-branch
 Changes by:	zack@gcc.gnu.org	2002-10-09 14:31:04
 
 Modified files:
 	gcc            : ChangeLog c-decl.c 
 	gcc/cp         : ChangeLog decl.c 
 	gcc/doc        : extend.texi 
 	gcc/testsuite  : ChangeLog 
 Added files:
 	gcc/testsuite/g++.dg/ext: typedef-init.C 
 	gcc/testsuite/gcc.dg: typedef-init.c 
 
 Log message:
 	PR c/7353
 	gcc:
 	* c-decl.c (start_decl): Unconditionally issue error for
 	'typedef foo = bar'.
 	(finish_decl): Remove special case for TYPE_DECL with initializer.
 	
 	* doc/extend.texi: Delete "Naming Types" section.  Change all
 	cross-references to that section to refer to "Typeof" instead.
 	Add the useful safe-max()-macro example from "Naming Types" to
 	"Typeof", rewritten using that extension.
 	
 	gcc/cp:
 	* decl.c (start_decl): Unconditionally issue error for
 	'typedef foo = bar'.
 	(cp_finish_decl): Remove special case for TYPE_DECL with initializer.
 	(grokdeclarator): Remove redundant error for 'typedef foo = bar'.
 	
 	gcc/testsuite:
 	* g++.dg/ext/typedef-init.C: New test.
 	* gcc.dg/typedef-init.c: New test.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.13152.2.657.2.80&r2=1.13152.2.657.2.81
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-decl.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.300.2.10.2.1&r2=1.300.2.10.2.2
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.2685.2.114.2.15&r2=1.2685.2.114.2.16
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.866.2.36.2.2&r2=1.866.2.36.2.3
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/doc/extend.texi.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.64.2.2.4.1&r2=1.64.2.2.4.2
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=1.1672.2.166.2.21&r2=1.1672.2.166.2.22
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/typedef-init.C.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=NONE&r2=1.1.2.1
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/typedef-init.c.diff?cvsroot=gcc&only_with_tag=gcc-3_2-branch&r1=NONE&r2=1.1.2.1
 
Comment 9 Zack Weinberg 2002-11-02 02:17:42 UTC
From: zack@gcc.gnu.org
To: gcc-gnats@gcc.gnu.org
Cc:  
Subject: c/7353
Date: 2 Nov 2002 02:17:42 -0000

 CVSROOT:	/cvs/gcc
 Module name:	gcc
 Changes by:	zack@gcc.gnu.org	2002-11-01 18:17:42
 
 Modified files:
 	gcc/cp         : ChangeLog decl2.c 
 	gcc/testsuite  : ChangeLog 
 	gcc/testsuite/g++.dg/ext: typedef-init.C 
 	gcc/testsuite/gcc.dg: typedef-init.c 
 
 Log message:
 	PR c/7353 redux
 	cp:
 	* decl2.c (grokfield): Reject TYPE_DECLs with initializers.
 	testsuite:
 	* g++.dg/ext/typedef-init.C, gcc.dg/typedef-init.C:
 	Add some more cases.
 
 Patches:
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3035&r2=1.3036
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/decl2.c.diff?cvsroot=gcc&r1=1.569&r2=1.570
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.2195&r2=1.2196
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/ext/typedef-init.C.diff?cvsroot=gcc&r1=1.1&r2=1.2
 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/typedef-init.c.diff?cvsroot=gcc&r1=1.1&r2=1.2