Bug 18525 - ICE on valid code in gfc_get_symbol_decl()
Summary: ICE on valid code in gfc_get_symbol_decl()
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: fortran (show other bugs)
Version: 4.0.0
: P2 normal
Target Milestone: 4.0.0
Assignee: Tobias Schlüter
URL:
Keywords: ice-on-valid-code, monitored, patch
Depends on:
Blocks:
 
Reported: 2004-11-17 11:58 UTC by Martin Reinecke
Modified: 2005-03-19 19:54 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail: 4.0.0
Last reconfirmed: 2005-03-06 18:10:09


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Reinecke 2004-11-17 11:58:53 UTC
The following testcase causes an ICE in the current gfortran. 
The code seems ill-formed to me, because the name "n" 
was already defined as a constant in the module scope, 
but I'm not sure. 
 
This was originally reported by Vivek Rao (vivekrao4@yahoo.com). 
 
module zz 
integer, parameter :: n=2 ! causes ICE 
contains 
subroutine xx(n) 
call yy(n) 
end subroutine xx 
end module zz 
 
~/tmp>gfortran -v -c bug.f90 
Reading specs 
from /afs/mpa/data/martin/ugcc/lib/gcc/i686-pc-linux-gnu/4.0.0/specs 
Configured with: /scratch/gcc/configure --quiet 
--prefix=/afs/mpa/data/martin/ugcc --enable-languages=c++,f95 
--with-gmp=/afs/mpa/data/martin/mygmp 
Thread model: posix 
gcc version 4.0.0 20041117 (experimental) 
 /afs/mpa/data/martin/ugcc/libexec/gcc/i686-pc-linux-gnu/4.0.0/f951 bug.f90 
-quiet -dumpbase bug.f90 -mtune=pentiumpro -auxbase bug -version 
-o /tmp/ccVLWgWD.s 
GNU F95 version 4.0.0 20041117 (experimental) (i686-pc-linux-gnu) 
        compiled by GNU C version 4.0.0 20041117 (experimental). 
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 
bug.f90: In function 'xx': 
bug.f90:4: internal compiler error: in gfc_get_symbol_decl, at 
fortran/trans-decl.c:704 
Please submit a full bug report, 
with preprocessed source if appropriate. 
See <URL:http://gcc.gnu.org/bugs.html> for instructions.
Comment 1 Andrew Pinski 2004-11-17 12:58:36 UTC
Confirmed, this is related to PR 13082.
Comment 2 Thomas Koenig 2004-11-17 15:39:11 UTC
The code is perfectly valid.  Here,
n in the subroutine hides the host parameter n
(which is then inaccessible in the subroutine xx).
Comment 3 Martin Reinecke 2004-11-17 16:18:07 UTC
Thanks, I have updated the title and keywords now. 
Comment 4 Tobias Schlüter 2005-03-06 18:10:09 UTC
Patch here: http://gcc.gnu.org/ml/fortran/2005-03/msg00091.html
Comment 5 CVS Commits 2005-03-19 19:45:58 UTC
Subject: Bug 18525

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	tobi@gcc.gnu.org	2005-03-19 19:45:46

Modified files:
	gcc/fortran    : ChangeLog dump-parse-tree.c resolve.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gfortran.dg: nesting_1.f90 

Log message:
	fortran/
	* dump-parse-tree.c (gfc_show_expr): Dump name of namespace
	in which the variable is declared.
	
	PR fortran/18525
	* resolve.c (was_declared): Also check for dummy attribute.
	
	testsuite/
	PR fortran/18525
	* gfortran.dg/nesting_1.f90: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/ChangeLog.diff?cvsroot=gcc&r1=1.360&r2=1.361
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/dump-parse-tree.c.diff?cvsroot=gcc&r1=1.14&r2=1.15
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/resolve.c.diff?cvsroot=gcc&r1=1.38&r2=1.39
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5183&r2=1.5184
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/nesting_1.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1

Comment 6 CVS Commits 2005-03-19 19:53:00 UTC
Subject: Bug 18525

CVSROOT:	/cvs/gcc
Module name:	gcc
Branch: 	gcc-4_0-branch
Changes by:	tobi@gcc.gnu.org	2005-03-19 19:52:53

Modified files:
	gcc/fortran    : ChangeLog dump-parse-tree.c resolve.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gfortran.dg: nesting_1.f90 

Log message:
	fortran/
	* dump-parse-tree.c (gfc_show_expr): Dump name of namespace
	in which the variable is declared.
	
	PR fortran/18525
	* resolve.c (was_declared): Also check for dummy attribute.
	
	testsuite/
	PR fortran/18525
	* gfortran.dg/nesting_1.f90: New test.

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.16&r2=1.335.2.17
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/dump-parse-tree.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.14&r2=1.14.2.1
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/resolve.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.34.2.4&r2=1.34.2.5
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.5084.2.53&r2=1.5084.2.54
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/nesting_1.f90.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1

Comment 7 Tobias Schlüter 2005-03-19 19:54:28 UTC
Fixed.