gcc crashes compiling the C code below, if both debugging and optimization are on: $ ./cc1 x.c -quiet -g -O2 x.c: In function `a': x.c:5: internal compiler error: in gen_subprogram_die, at dwarf2out.c:10696 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. $ [sss@karma gcc] It's tripping over this abort in gen_subprogram_die: /* ??? This can happen if there is a bug in the program, for instance, if it has duplicate function definitions. Ideally, we should detect this case and ignore it. For now, if we have already reported an error, any error at all, then assume that we got here because of an input error, not a dwarf2 bug. */ if (errorcount) return; abort (); Environment: System: Linux karma 2.6.1 #10 Tue Feb 10 04:31:35 EST 2004 i686 i686 i386 GNU/Linux Architecture: i686 <machine, os, target, libraries (multiple lines)> host: i686-pc-linux-gnu build: i686-pc-linux-gnu target: i686-pc-linux-gnu configured with: ../gcc/configure --prefix=/usr/local/gcc --enable-threads=posix --enable-long-long --enable-languages=c,c++,f77 How-To-Repeat: Compile with -g -O2: --------------------------------------- void a() { void c(); c(); } void b() { void c(); } void c() {} ---------------------------------------
Fix: <how to correct or work around the problem, if known (multiple lines)>
Confirmed, this is an unit-at-a-time problem.
Or it could be caused by Zack's rewrite of c-decl.c I do not know which one because they interact with each other.
*** Bug 14139 has been marked as a duplicate of this bug. ***
Investigating.
We eventually sort of agreed that this is a C front-end problem.
Subject: Bug 14114 CVSROOT: /cvs/gcc Module name: gcc Changes by: ebotcazou@gcc.gnu.org 2004-03-06 09:28:51 Modified files: gcc/testsuite : ChangeLog Added files: gcc/testsuite/gcc.dg: decl-5.c Log message: PR c/14114 * gcc.dg/decl-5.c: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3572&r2=1.3573 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/decl-5.c.diff?cvsroot=gcc&r1=NONE&r2=1.1
Subject: Bug 14114 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_4-branch Changes by: ebotcazou@gcc.gnu.org 2004-03-06 09:39:18 Modified files: gcc : ChangeLog c-decl.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/gcc.dg: decl-5.c Log message: PR c/14114 * c-decl (pushdecl): Do not record a previous, not-in-scope, external decl for restoration. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.294&r2=2.2326.2.295 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-decl.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.470.4.6&r2=1.470.4.7 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.123&r2=1.3389.2.124 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/decl-5.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1
Fixed on the 3.4 branch: http://gcc.gnu.org/ml/gcc-patches/2004-03/msg00258.html Zack doesn't want the patch to interfere with his new c-decl.c rewrite.
Subject: Bug 14114 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_4-branch Changes by: ebotcazou@gcc.gnu.org 2004-03-07 00:39:03 Modified files: gcc : ChangeLog c-decl.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/gcc.dg: decl-6.c Log message: PR c/14465 PR c/14114 * c-decl (pushdecl): Revert previous change. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.297&r2=2.2326.2.298 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-decl.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.470.4.7&r2=1.470.4.8 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.125&r2=1.3389.2.126 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/decl-6.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=NONE&r2=1.1.2.1
Patch: http://gcc.gnu.org/ml/gcc-patches/2004-03/msg00724.html
Subject: Re: [3.4/3.5 Regression] [unit-at-a-time] ICE in gen_subprogram_die This patch is OK for 3.4.0.
Subject: Bug 14114 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_4-branch Changes by: ebotcazou@gcc.gnu.org 2004-03-13 19:05:48 Modified files: gcc : ChangeLog c-decl.c gcc/testsuite : ChangeLog gcc/testsuite/gcc.dg: decl-5.c Log message: PR c/14114 * c-decl.c (merge_decls): Do not copy the C_DECL_INVISIBLE flag from the new decl to the old decl. (pushdecl): Use lookup_name to search for a previous decl with the same identifier. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=2.2326.2.339&r2=2.2326.2.340 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/c-decl.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.470.4.9&r2=1.470.4.10 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.3389.2.143&r2=1.3389.2.144 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gcc.dg/decl-5.c.diff?cvsroot=gcc&only_with_tag=gcc-3_4-branch&r1=1.1.2.3&r2=1.1.2.4
Fixed on 3.4 branch. Zack, I reassign the PR to you. Let me know if I can do anything else.
Fixed by the c-decl.c rewrite: http://gcc.gnu.org/ml/gcc-patches/2004-03/msg01280.html
Now fixed in 3.5.