g77 crashes when compiling the source below with -g -O3. $ g77 -c -g -O3 x.f x.f:1: internal compiler error: in add_abstract_origin_attribute, at dwarf2out.c:9896 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. $ Environment: System: Linux upton-clued0 2.4.17-0.4XFSsmp #1 SMP Tue Mar 12 14:18:33 CST 2002 i686 unknown Architecture: i686 host: i686-pc-linux-gnu build: i686-pc-linux-gnu target: i686-pc-linux-gnu configured with: ../gcc/configure --prefix=/work/shoreham-clued0/snyder/gcc-3.3/inst --enable-threads=posix --enable-long-long --enable-languages=c,c++,f77 --disable-shared How-To-Repeat: Compile the below with -g -O3: ------------------------------------ SUBROUTINE ISAWEV LOGICAL EDIT ENTRY WRTAPE IF(EDIT(I)) RETURN RETURN END ------------------------------------
I can confirm this on the mainline (20030714) and 3.3.1 (20030707). It worked in 3.0.4 (with -gdwarf-2 added since 3.0.4 defaulted to stabs) so this is a regression but it most likely will not be fixed until 3.3.2 since 3.3.1 is just days away.
This case - ICEs (see below) with 2003-07-14 CVS 3.3 and 3.4 on irix6.5, - compiles with 2003-07-14 CVS 3.3 and 3.4 on cygwin - compiles with irix gcc-2.95.2 with 2003-07-14 CVS 3.3 on irix6.5 isawev.f:1: ICE: in add_abstract_origin_attribute, at dwarf2out.c:9886 with 2003-07-14 CVS 3.4 on irix6.5 isawev.f:1: ICE: in add_abstract_origin_attribute, at dwarf2out.c:9851
Forgot to change the summary and since according to David this bug is target independent except for the need to support dwarf-2 debuging.
This looks suspiciously similar to Bug 9864, but the patch for that bug does not fix this ICE, unfortunately. Changing "component" to "fortran" since 9864 turned out to be an FFE bug, not a "debug" problem; this one looks so similar that it probably is just an FFE bug, too. Added Toon because he's the fortran maintainer.
The regression in PR 11522 was introduced or exposed by this patch: --- gcc/gcc/ChangeLog --- 2002-02-26 Alexandre Oliva <aoliva@redhat.com> * dwarf2out.c (gen_inlined_subroutine_die): If block is abstract, generate a die for the lexical block. The regression hunt used the submitter's test case on i686-pc-linux-gnu with options "-O3 -gdwarf-2"
This bug was caused by Alexandre's change.
Subject: Re: [3.3/3.4 Regression] g77 dwarf-2 ICE in add_abstract_origin_attribute On Sep 5, 2003, "mmitchel at gcc dot gnu dot org" <gcc-bugzilla@gcc.gnu.org> wrote: > This bug was caused by Alexandre's change. This patch fixes it. Without it, we end up attempting to emit a die for the inlined copy of a function declaration, and then, erhm, die :-) because the die for the original declaration wasn't emitted. It seems that, with tree inlining, we always end up emitting the abstract decl for the inlined function before we get to that point, so the buggy case never hit. Ok to install? Index: gcc/ChangeLog from Alexandre Oliva <aoliva@redhat.com> PR fortran/11522 * dwarf2out.c (gen_inlined_subroutine_die): Emit abstract function for ultimate origin even if block is abstract. Index: gcc/dwarf2out.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/dwarf2out.c,v retrieving revision 1.390.2.8 diff -u -p -r1.390.2.8 dwarf2out.c --- gcc/dwarf2out.c 20 Jul 2003 07:22:55 -0000 1.390.2.8 +++ gcc/dwarf2out.c 7 Sep 2003 05:01:42 -0000 @@ -11051,15 +11051,19 @@ gen_inlined_subroutine_die (stmt, contex dw_die_ref context_die; int depth; { + tree decl = block_ultimate_origin (stmt); + + /* Emit info for the abstract instance first, if we haven't yet. We + must emit this even if the block is abstract, otherwise when we + emit the block below (or elsewhere), we may end up trying to emit + a die whose origin die hasn't been emitted, and crashing. */ + dwarf2out_abstract_function (decl); + if (! BLOCK_ABSTRACT (stmt)) { dw_die_ref subr_die = new_die (DW_TAG_inlined_subroutine, context_die, stmt); - tree decl = block_ultimate_origin (stmt); char label[MAX_ARTIFICIAL_LABEL_BYTES]; - - /* Emit info for the abstract instance first, if we haven't yet. */ - dwarf2out_abstract_function (decl); add_abstract_origin_attribute (subr_die, decl); ASM_GENERATE_INTERNAL_LABEL (label, BLOCK_BEGIN_LABEL, -- Alexandre Oliva Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/ Red Hat GCC Developer aoliva@{redhat.com, gcc.gnu.org} CS PhD student at IC-Unicamp oliva@{lsd.ic.unicamp.br, gnu.org} Free Software Evangelist Professional serial bug killer
Subject: Bug 11522 CVSROOT: /cvs/gcc Module name: gcc Changes by: aoliva@gcc.gnu.org 2003-09-11 13:41:57 Modified files: gcc : ChangeLog dwarf2out.c Log message: PR fortran/11522 * dwarf2out.c (gen_inlined_subroutine_die): Emit abstract function for ultimate origin even if block is abstract. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.1030&r2=2.1031 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/dwarf2out.c.diff?cvsroot=gcc&r1=1.449&r2=1.450
Subject: Bug 11522 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_3-branch Changes by: aoliva@gcc.gnu.org 2003-09-11 13:42:41 Modified files: gcc : ChangeLog dwarf2out.c Log message: PR fortran/11522 * dwarf2out.c (gen_inlined_subroutine_die): Emit abstract function for ultimate origin even if block is abstract. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.16114.2.735&r2=1.16114.2.736 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/dwarf2out.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.390.2.8&r2=1.390.2.9
Fixed by the patch.
*** Bug 12456 has been marked as a duplicate of this bug. ***
*** Bug 12449 has been marked as a duplicate of this bug. ***
I do not understand what this has to do with STRING(K:K) not being recognized as a single character for assignment [Bug fortran/12456]
Just a note that the bug which had been marked as dup of this one which dealt with STRING(K:K) was not a dup of this bug but a user error of marking as a dup, it has now been reopened already.