Bug 9864

Summary: [3.3/3.4 regression] Fortran ICE in dwarf2out:add_abstract_origin_attribute with -g -O -finline-functions
Product: gcc Reporter: jiri.pittner
Component: debugAssignee: Richard Henderson <rth>
Status: RESOLVED FIXED    
Severity: normal CC: gcc-bugs, janis187, reichelt, s.bosscher, steven
Priority: P3 Keywords: ice-on-valid-code
Version: 3.2   
Target Milestone: 3.3.1   
Host: Target:
Build: Known to work:
Known to fail: Last reconfirmed: 2003-05-28 23:11:28
Attachments: master.f
bug.f

Description jiri.pittner 2003-02-26 16:06:01 UTC
g77-3.3 bug.f -c -O -finline-functions -g
where bug.f looks like this:
------------------------
      SUBROUTINE MASTER(Q,MAXQ)
      INTEGER MAXQ
      DOUBLE PRECISION Q
      DIMENSION Q(MAXQ)
      CALL ANHARM(Q,MAXQ)
      END

      SUBROUTINE DUMMY
      ENTRY ANHARM
      CALL REPORT('a bit optimistic - come back next year')
      RETURN
      END
------------------------
bug.f: In subroutine `dummy':
bug.f:5: warning:
         CALL ANHARM(Q,MAXQ)
              1
bug.f:9: (continued):
         ENTRY ANHARM
               2
Too few arguments for `anharm' at (1) versus invocation at (2) [info -f g77 M GLOBALS]
bug.f: Outside of any program unit:
bug.f:8: internal compiler error: in add_abstract_origin_attribute, at dwarf2out.c:9879
Please submit a full bug report,
with preprocessed source if appropriate.
See <URL:http://www.gnu.org/software/gcc/bugs.html> for instructions.

Release:
gcc 3.2

Environment:
SuSE Linux/386

How-To-Repeat:
The critical flags to trigger this are -g and -finline-functions (which requires -O).
Comment 1 Wolfgang Bangerth 2003-03-15 05:23:43 UTC
State-Changed-From-To: open->analyzed
State-Changed-Why: Confirmed. Actually an ICE in the debug writer:
    
    g/x> /home/bangerth/bin/gcc-3.2.2-pre/bin/g77 -c -O3 -g   -w -fno-globals master.f
    master.F:566: Internal compiler error in add_abstract_origin_attribute, at dwarf2out.c:9458
    Please submit a full bug report,
    
    This didn't use to ICE in 2.95 (even with -gdwarf-2), but
    ICEs in 3.2.2, 3.3 and mainline, so is a regression.
    
    
    W.
Comment 2 s.bosscher 2003-03-26 10:13:19 UTC
From: Steven Bosscher <s.bosscher@student.tudelft.nl>
To: gcc-gnats@gcc.gnu.org, jiri.pittner@jh-inst.cas.cz,
	gcc-bugs@gcc.gnu.org, toon@moene.indiv.nluug.nl, nobody@gcc.gnu.org,
	gcc-prs@gcc.gnu.org
Cc:  
Subject: Re: debug/9864: [3.2/3.3/3.4 regression] Fortran ICE in dwarf2out:add_abstract_origin_attribute
 with -g -O -finline-functions
Date: Wed, 26 Mar 2003 10:13:19 +0100

 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9864
 
 I've just analyzed this PR a bit more and I've reduced the test case
 to managable proportions (12 lines instead of almost 500 :-).
 
 This looks like something specific to Fortran (i.e. something we'll
 only be able to reproduce with the Fortran front end), so I've added
 Toon to the "Who's interested" list.
 
 Greetz
 Steven
 
 

Comment 3 janis187 2003-03-26 16:34:08 UTC
From: Janis Johnson <janis187@us.ibm.com>
To: gcc-gnats@gcc.gnu.org, jiri.pittner@jh-inst.cas.cz, gcc-bugs@gcc.gnu.org,
   toon@moene.indiv.nluug.nl, nobody@gcc.gnu.org, gcc-prs@gcc.gnu.org,
   aoliva@redhat.com
Cc:  
Subject: Re: debug/9864: [3.2/3.3/3.4 regression] Fortran ICE in 
 dwarf2out:add_abstract_origin_attribute with -g -O -finline-functions
Date: Wed, 26 Mar 2003 16:34:08 -0800

 The regression appeared with this patch:
 
 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 hunt used the small test case on i686-pc-linux-gnu with
 the options "-O -finline-functions -g", with mainline.
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9864
 
 
 
Comment 4 Steven Bosscher 2003-04-12 12:53:11 UTC
Responsible-Changed-From-To: unassigned->aoliva
Responsible-Changed-Why: You broke this, and you know more about dwarf2 than most :-)
Comment 5 Volker Reichelt 2003-04-16 22:35:55 UTC
From: Volker Reichelt <reichelt@igpm.rwth-aachen.de>
To: gcc-gnats@gcc.gnu.org, jiri.pittner@jh-inst.cas.cz, gcc-bugs@gcc.gnu.org,
 toon@moene.indiv.nluug.nl, aoliva@gcc.gnu.org
Cc:  
Subject: Re: debug/9864: [3.2/3.3/3.4 regression] Fortran ICE in
 dwarf2out:add_abstract_origin_attribute with -g -O -finline-functions
Date: Wed, 16 Apr 2003 22:35:55 +0200 (CEST)

 Here's an even shorter testcase without all the warnings (which still ICEs):
 
 -----------------------snip here------------------------
       SUBROUTINE FOO
       CALL BAR
       END
 
       SUBROUTINE BAZ
       ENTRY BAR
       CALL QUUS
       END
 -----------------------snip here------------------------
 
 Regards,
 Volker
 
 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9864
Comment 6 Richard Henderson 2003-06-12 20:33:22 UTC
Looking at it.
Comment 7 Richard Henderson 2003-06-13 23:30:22 UTC
http://gcc.gnu.org/ml/gcc-patches/2003-06/msg01332.html
Comment 8 GCC Commits 2003-06-14 00:36:08 UTC
Subject: Bug 9864

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-3_3-branch
Changes by:	rth@gcc.gnu.org	2003-06-14 00:36:06

Modified files:
	gcc/f          : ChangeLog com.c 

Log message:
	PR debug/9864
	* com.c (ffecom_sym_transform_): Install FFEINFO_whereGLOBAL
	symbols in the global binding level.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/f/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.503.2.26&r2=1.503.2.27
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/f/com.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.182.4.2&r2=1.182.4.3

Comment 9 Kirill Smelkov 2003-08-10 12:43:29 UTC
The bug seems to be not closed as the following produces ICE. 
 
------- 
c     g77.331 -c -g -O -finline-functions bug.f     -> ICE 
c 
      subroutine aaaa 
      implicit none 
 
      external cccc 
 
      return 
 
      entry bbbb 
 
      end 
------ 
 
bug.f:3: internal compiler error: in add_abstract_origin_attribute, at dwarf2out.c:9886 
Please submit a full bug report, 
with preprocessed source if appropriate. 
See <URL:http://gcc.gnu.org/bugs.html> for instructions. 
 
Release: 
gcc 3.3.1 
 
Comment 10 Andrew Pinski 2003-08-10 13:55:34 UTC
The ICE you are referring to is filled under PR 11522 so there is no need to reopen this bug.