Bug 22502 - [4.0.1 Regression] ICE constructing arrays with "(/ /)"
Summary: [4.0.1 Regression] ICE constructing arrays with "(/ /)"
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.1.0
: P2 normal
Target Milestone: 4.0.2
Assignee: Volker Reichelt
URL: http://gcc.gnu.org/ml/gcc-patches/200...
Keywords: ice-on-valid-code, monitored, patch
Depends on:
Blocks:
 
Reported: 2005-07-15 15:02 UTC by Erik Schnetter
Modified: 2005-09-10 21:42 UTC (History)
4 users (show)

See Also:
Host:
Target:
Build:
Known to work: 4.0.0 4.1.0
Known to fail: 4.0.1 4.0.2
Last reconfirmed: 2005-07-15 16:28:02


Attachments
Failing gzipped source code (26.80 KB, application/octet-stream)
2005-07-15 15:02 UTC, Erik Schnetter
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Erik Schnetter 2005-07-15 15:02:02 UTC
The attached source file, when compiled with 
 
GNU Fortran 95 (GCC 4.1.0 20050715 (experimental)) 
 
/home/eschnett/gcc /bin/gfortran -ftrapv -fwrapv -march=pentium4 
-malign-double -g3 -Wall -Wshadow -c -o HarmExactEvol_ExactADM.F90.o 
HarmExactEvol_ExactADM.f90 
 
leads to the error message 
 
/home/eschnett/Calpha/Cactus/arrangements/Abigel/HarmExactEvol/src/HarmExactEvol 
_ExactADM.F90:154: internal compiler error: tree check: expected class 'type', 
h 
ave 'exceptional' (^O¶ÂÁà^F^E<80><9B><80>x      ^A^O<85>0^B) in 
build_array_type 
, at tree.c:4845 
 
Note that the error message itself is corrupted.
Comment 1 Erik Schnetter 2005-07-15 15:02:42 UTC
Created attachment 9281 [details]
Failing gzipped source code
Comment 2 Volker Reichelt 2005-07-15 16:28:01 UTC
Confirmed.

There seems to be some memory corruption. With the command line arguments
"--param ggc-min-expand=0 --param ggc-min-heapsize=0" I get a plain segfault.
The segfault can be reproduced with the following testcase (compile with
"gfortran --param ggc-min-expand=0 --param ggc-min-heapsize=0"):

========================================
subroutine FOO
end subroutine FOO

subroutine BAR
  integer :: I
  if (any ((/ I /) .eq. 0) ) I = 0
end subroutine BAR
========================================

The problem appeared in gcc 4.0.1 (reduced and original testcase).

Btw, one has to strip the "use" commands from the original testcase
in order to compile it.
Comment 3 Volker Reichelt 2005-07-15 16:40:06 UTC
The "ANY" function isn't the culprit.
Building arrays with (/ /) causes the problem:

=======================
subroutine FOO
end subroutine FOO

subroutine BAR
  integer :: J(1)
  J = (/ 1 /)
end subroutine BAR
=======================
Comment 4 Volker Reichelt 2005-07-15 21:22:50 UTC
Zdenek, this was caused by your patch
http://gcc.gnu.org/ml/fortran/2005-05/msg00178.html

Could you please have a look?
Comment 5 Volker Reichelt 2005-07-29 09:54:53 UTC
Steven,

your patch
http://gcc.gnu.org/ml/gcc-cvs/2005-07/msg01042.html
seems to fix this PR on mainline.

Is this an appropriate fix for the 4.0 branch, too?
Would you mind adding a testcase?

Btw, your patch changes trans-types.c, but the ChangeLog does not mention
the change. Could you please fix that?
Comment 6 Mark Mitchell 2005-08-22 03:52:52 UTC
Fortran is not release-critical; removing target milestone.
Comment 7 Volker Reichelt 2005-09-10 07:50:22 UTC
Taking care of the backport to the 4.0 branch.
Comment 8 GCC Commits 2005-09-10 21:40:05 UTC
Subject: Bug 22502

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	reichelt@gcc.gnu.org	2005-09-10 21:40:00

Modified files:
	gcc/fortran    : ChangeLog trans-types.h 

Log message:
	PR fortran/22502
	Backport:
	
	2005-07-29  Steven Bosscher  <stevenb@suse.de>
	* trans-types.h (gfc_array_range_type): Add missing GTY decl for this.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.335.2.116&r2=1.335.2.117
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/trans-types.h.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.9&r2=1.9.14.1

Comment 9 Volker Reichelt 2005-09-10 21:42:17 UTC
Now also fixed on the 4.0 branch.