[Bug fortran/11522] [3.3/3.4 Regression] g77 dwarf-2 ICE in add_abstract_origin_attribute

aoliva at redhat dot com gcc-bugzilla@gcc.gnu.org
Sun Sep 7 05:10:00 GMT 2003


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11522



------- Additional Comments From aoliva at redhat dot com  2003-09-07 05:10 -------
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



More information about the Gcc-bugs mailing list