Bug 17423

Summary: gfortran segfault when compiling FM509.f from NIST testsuite
Product: gcc Reporter: Jerry DeLisle <jvdelisle>
Component: fortranAssignee: Not yet assigned to anyone <unassigned>
Status: RESOLVED FIXED    
Severity: normal CC: epc8, gcc-bugs, wf_cs
Priority: P2 Keywords: ice-on-valid-code
Version: 4.0.0   
Target Milestone: 4.0.1   
Host: i686-pc-linux-gnu Target: i686-pc-linux-gnu
Build: i686-pc-linux-gnu Known to work:
Known to fail: Last reconfirmed: 2004-09-12 00:56:35
Bug Depends on: 18600    
Bug Blocks: 13082, 19292    

Description Jerry DeLisle 2004-09-11 22:23:51 UTC
FM509.f causes segfault when attempting to compile.  gdb output as follows:

(gdb) set args FM509.f
(gdb) run
Starting program: /home/jerry/bin/f951 FM509.f
 MAIN__
 sn510
 
Program received signal SIGSEGV, Segmentation fault.
0x080a0494 in gfc_create_function_decl (ns=0x87c01a0)
    at ../../gcc-3.5-20040905/gcc/fortran/trans-decl.c:1384
1384                  if (formal->sym->ts.type == BT_CHARACTER)
(gdb)
Comment 1 Andrew Pinski 2004-09-11 23:11:31 UTC
This is related to bug 13082.  Can you attach the fortran source if the license of the testsuite allows it?
Comment 2 Jerry DeLisle 2004-09-11 23:21:58 UTC
Using gdb with f951 I get the segfaults on the following programs from
the NIST test suite:

FM509.f         trans-decl.c:1384
FM517.f         trans-decl.c:1372
FM711.f         trans-array.c:1619
FM903.f         trans-array.c:1619
FM908.f         trans-array.c:1619
FM909.f         trans-array.c:1619

Test suite downloaded from:

http://www.fortran-2000.com/ArnaudRecipes/fcvs21_f95.html

'modified' version used.  Software is public domain, provide acknowledgement of
NIST.
Comment 3 Bud Davis 2004-09-12 00:53:17 UTC
reduced test case:


      SUBROUTINE SN510(IVD021,IVD002)
      RETURN
      ENTRY EN858(IVD019,*,*)
      END
 


Comment 4 Andrew Pinski 2004-09-12 00:56:35 UTC
So lets change this so we block the other bug.
Comment 5 Jerry DeLisle 2004-11-10 02:45:33 UTC
Latest run of NIST f77 testsuite.  There appears to be 3 of the previously
reported errors and 5 additional new ones.

GNU Fortran 95 (GCC 4.0.0 20041108 (experimental))
Copyright (C) 2004 Free Software Foundation, Inc.
  

FM020.f:177: internal compiler error: in gfc_add_modify_expr, at fortran/trans.c:154
FM311.f:401: internal compiler error: in gfc_add_modify_expr, at fortran/trans.c:154
FM328.f:465: internal compiler error: in gfc_add_modify_expr, at fortran/trans.c:154
FM509.f:487: internal compiler error: Segmentation fault
FM517.f:335: internal compiler error: Segmentation fault
FM711.f:171: internal compiler error: Segmentation fault
FM903.f:195: internal compiler error: Segmentation fault
FM908.f:187: internal compiler error: Segmentation fault
FM909.f:228: internal compiler error: Segmentation fault
Comment 6 Jerry DeLisle 2004-11-10 02:52:30 UTC
Argh! Five of the old, three new.  Sorry about that.
Comment 7 Jerry DeLisle 2004-12-11 05:59:40 UTC
ICE on NIST FM252.f reduced case similar to pr#18827


      PROGRAM FM252
C
      ASSIGN 0012 TO I
 0012 FORMAT (" **** ASSIGN FORMAT NUMBER TO INTEGER VARIABLE ****" )

      END
Comment 8 Jerry DeLisle 2004-12-11 06:34:11 UTC
Some regressions showing up: FM111 and FM252

FM111.f:241: internal compiler error: in gfc_add_modify_expr, at fortran/trans.c:154
FM252.f:115: internal compiler error: in gfc_add_modify_expr, at fortran/trans.c:154

gcc version 4.0.0 20041210 (experimental)
Comment 9 Andrew Pinski 2005-04-30 17:54:50 UTC
The reduced testcase in Comment #7 still ICEs. 
Comment 10 Jerry DeLisle 2005-05-07 22:16:35 UTC
A patch to fix the problem in comment #7 has been submitted for review.
Comment 11 Andrew Pinski 2005-05-15 03:25:14 UTC
Fixed.
Comment 12 Andrew Pinski 2005-05-16 02:29:10 UTC
*** Bug 17142 has been marked as a duplicate of this bug. ***