Bug 16907 - Non-integer array indices rejected
Non-integer array indices rejected
Status: RESOLVED FIXED
Product: gcc
Classification: Unclassified
Component: fortran
4.0.0
: P2 enhancement
: 4.0.0
Assigned To: Not yet assigned to anyone
: monitored, rejects-valid
Depends on:
Blocks: 19292
  Show dependency treegraph
 
Reported: 2004-08-06 22:25 UTC by Volker Reichelt
Modified: 2005-04-20 02:13 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Known to work:
Known to fail:
Last reconfirmed: 2005-02-26 18:42:19


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Volker Reichelt 2004-08-06 22:25:02 UTC
The following code is accepted without warning by g77, but rejected
by gfortran:

====================================
       integer I, A(10)
       I=A(1.0)
       end
====================================

 In file bug.f:2

       I=A(1.0)                                                         
          1
Error: Array index at (1) must be of INTEGER type

But I suppose there's lots of code containing non-integer array indices
so IMHO this should only be a warning in gfortran (and an error with
-pedantic like in g77).

This issue is similar to the non-integer loop variables in PR 16222.
Comment 1 Andrew Pinski 2004-08-07 22:07:20 UTC
Confirmed.
Comment 2 CVS Commits 2005-03-13 18:46:49 UTC
Subject: Bug 16907

CVSROOT:	/cvs/gcc
Module name:	gcc
Changes by:	tobi@gcc.gnu.org	2005-03-13 18:46:37

Modified files:
	gcc/fortran    : ChangeLog resolve.c 
	gcc/testsuite  : ChangeLog 
Added files:
	gcc/testsuite/gfortran.dg: real_index_1.f90 

Log message:
	fortran/
	PR fortran/16907
	* resolve.c (gfc_resolve_index): Allow REAL indices as an extension.
	
	testsuite/
	PR fortran/16907
	* gfortran.dg/real_index_1.f90: New test.

Patches:
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/ChangeLog.diff?cvsroot=gcc&r1=1.350&r2=1.351
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/fortran/resolve.c.diff?cvsroot=gcc&r1=1.36&r2=1.37
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.5155&r2=1.5156
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/real_index_1.f90.diff?cvsroot=gcc&r1=NONE&r2=1.1

Comment 3 CVS Commits 2005-03-13 19:07:58 UTC
Subject: Bug 16907

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

Modified files:
	gcc/fortran    : resolve.c 
Added files:
	gcc/testsuite/gfortran.dg: real_index_1.f90 

Log message:
	fortran/
	PR fortran/16907
	* resolve.c (gfc_resolve_index): Allow REAL indices as an extension.
	
	testsuite/
	PR fortran/16907
	* gfortran.dg/real_index_1.f90: New test.

Patches:
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.2&r2=1.34.2.3
http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/gfortran.dg/real_index_1.f90.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=NONE&r2=1.1.2.1

Comment 4 CVS Commits 2005-03-13 19:09:41 UTC
Subject: Bug 16907

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

Modified files:
	gcc/fortran    : ChangeLog 
	gcc/testsuite  : ChangeLog 

Log message:
	Add ChangeLog entries for previous commit fortran/
	PR fortran/16907
	* resolve.c (gfc_resolve_index): Allow REAL indices as an extension.
	
	testsuite/
	PR fortran/16907
	* gfortran.dg/real_index_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.11&r2=1.335.2.12
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.39&r2=1.5084.2.40

Comment 5 Tobias Schlüter 2005-03-13 19:10:01 UTC
Fixed.