This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/34546] New: Incorrect array identified in out of bounds runtime error
- From: "terry at chem dot gu dot se" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 21 Dec 2007 08:35:41 -0000
- Subject: [Bug fortran/34546] New: Incorrect array identified in out of bounds runtime error
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
I think this one's a bit bizarre. (But then again, which bugs aren't? ;-)
$ cat is
isotope* isotope.f90
[tjf@fkpc167 Bug9]$ cat isotope.f90
program fred
implicit none
integer,parameter::NoJmax=6000
integer,parameter::MaxTotalJ=100
integer,parameter::ER=14513
real,parameter::EnergyFactor=1.5
real(kind=8),dimension(ER:nint(EnergyFactor*ER),6)::pT
real(kind=8),dimension(0:MaxTotalJ,0:NoJmax,6)::JTEJ
integer::JJ,E
JTEJ=1
pT=2
write(*,*)ER
JJ=0
E=2000
write(*,*)size(JTEJ(JJ,E,:))
write(*,*)size(pT(E,:))
write(10,*)JJ,E,real(JTEJ(JJ,E,:))
write(10,*)JJ,E,real(JTEJ(JJ,E,:)*pT(E,:))
end
$ gfortran --version
GNU Fortran (GCC) 4.3.0 20071109 (experimental)
Copyright (C) 2007 Free Software Foundation, Inc.
GNU Fortran comes with NO WARRANTY, to the extent permitted by law.
You may redistribute copies of GNU Fortran
under the terms of the GNU General Public License.
For more information about these matters, see the file named COPYING
$ gfortran -Wall -W -Wtabs -g -fbounds-check -O -o isotope isotope.f90
$ ./isotope
14513
6
6
At line 23 of file isotope.f90
Fortran runtime error: Array reference out of bounds for array 'jtej', lower
bound of dimension 1 exceeded(2000 < 14513)
Yes, it's bad code. But what's with the bounds of pT being projected onto
JTEJ?
(Of course, apologies if it's been fixed since November!)
--
Summary: Incorrect array identified in out of bounds runtime
error
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: terry at chem dot gu dot se
GCC host triplet: x86_64-unknown-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34546