Bug 28415 - 4.2.0 ICE when using automatic array and -fno-automatic
Summary: 4.2.0 ICE when using automatic array and -fno-automatic
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.2.0
: P3 normal
Target Milestone: 4.1.2
Assignee: Jakub Jelinek
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords:
Depends on:
Blocks:
 
Reported: 2006-07-18 01:51 UTC by Greg Fruth
Modified: 2006-10-06 07:39 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2006-10-05 16:43:27


Attachments
Offending source code (149 bytes, text/plain)
2006-07-18 01:52 UTC, Greg Fruth
Details
compiler error messages (551 bytes, text/plain)
2006-07-18 01:53 UTC, Greg Fruth
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Greg Fruth 2006-07-18 01:51:20 UTC
When using an automatic array and the -fno-automatic
switch, I get the internal compiler error:

foo.f: In function ‘bar’:
foo.f:10: internal compiler error: in gfc_trans_auto_array_allocation, at fortran/trans-array.c:3593

Bug #21034 appears to be similar, but that was reported fixed in June 05
and I'm getting the error in 4.2.0 (SVN build).

The code compiles fine on g77 v3.4.5 (Linux x86_64) and on
Lahey LF95 v5.60a (Win2000 i386).
Comment 1 Greg Fruth 2006-07-18 01:52:23 UTC
Created attachment 11907 [details]
Offending source code
Comment 2 Greg Fruth 2006-07-18 01:53:59 UTC
Created attachment 11908 [details]
compiler error messages
Comment 3 Francois-Xavier Coudert 2006-07-18 08:44:59 UTC
Confirmed. Reduced testcase:

      subroutine bar(n)
      integer n, x(n)
      x(1) = 0
      end

$ gfortran a.f90 -fno-automatic -c
a.f90: In function ‘bar’:
a.f90:2: internal compiler error: in gfc_trans_auto_array_allocation, at fortran/trans-array.c:3593

The ICE is due to an assert(!TREE_STATIC (decl)).
Comment 4 patchapp@dberlin.org 2006-10-05 17:32:31 UTC
Subject: Bug number PR fortran/28415

A patch for this bug has been added to the patch tracker.
The mailing list url for the patch is http://gcc.gnu.org/ml/gcc-patches/2006-10/msg00258.html
Comment 5 Greg Fruth 2006-10-06 00:04:56 UTC
The patch works perfectly in 4.2.0(svn).  My application now
builds and runs successfully under gfortran.  Thanks, Jakub!
Comment 6 Jakub Jelinek 2006-10-06 07:23:10 UTC
Subject: Bug 28415

Author: jakub
Date: Fri Oct  6 07:23:00 2006
New Revision: 117482

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117482
Log:
	PR fortran/28415
	* trans-decl.c (gfc_finish_var_decl): With -fno-automatic, don't
	make artificial variables or pointer to variable automatic array
	TREE_STATIC.

	* gfortran.dg/save_2.f90: New test.

Added:
    trunk/gcc/testsuite/gfortran.dg/save_2.f90
Modified:
    trunk/gcc/fortran/ChangeLog
    trunk/gcc/fortran/trans-decl.c
    trunk/gcc/testsuite/ChangeLog

Comment 7 Jakub Jelinek 2006-10-06 07:33:46 UTC
Subject: Bug 28415

Author: jakub
Date: Fri Oct  6 07:33:34 2006
New Revision: 117485

URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=117485
Log:
	PR fortran/28415
	* trans-decl.c (gfc_finish_var_decl): With -fno-automatic, don't
	make artificial variables or pointer to variable automatic array
	TREE_STATIC.

	* gfortran.dg/save_2.f90: New test.

Added:
    branches/gcc-4_1-branch/gcc/testsuite/gfortran.dg/save_2.f90
Modified:
    branches/gcc-4_1-branch/gcc/fortran/ChangeLog
    branches/gcc-4_1-branch/gcc/fortran/trans-decl.c
    branches/gcc-4_1-branch/gcc/testsuite/ChangeLog

Comment 8 Jakub Jelinek 2006-10-06 07:39:49 UTC
Fixed in SVN.