This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/33745] -fbounds-check: Bogus out-of-bounds run-time error for assumed-size array
- From: "burnus at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 13 Oct 2007 14:34:45 -0000
- Subject: [Bug fortran/33745] -fbounds-check: Bogus out-of-bounds run-time error for assumed-size array
- References: <bug-33745-13404@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from burnus at gcc dot gnu dot org 2007-10-13 14:34 -------
(In reply to comment #2)
> The wrong-code bug is fixed by the followed patch.
Actually, it is not. The problem is - both in the compile time and at the run
time bound checking - the combination of element vs. array range.
Results using current gfortran (w/o wrong patch):
- jp(1:3,2:3): OK - compile-time warning and the run-time error
- jp(2,3): OK - no error/warning
- jp(3,1:2): No compile-time diagnostics of dimension 1 plus the following:
- jp(2,1:2): Bogus run-time error for the upper bound
The problem for the last two examples is:
- loop->dimen = 1 (one array range "1:2")
- info->ref->u.ar.dimen = 2 (total no. available dimensions 2)
- n = 0, ..., loop->dimen - 1
Thus the check "n == info->ref->u.ar.dimen - 1" is never true although "n ==
0"
is the last dimension of an assumed-sized array.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33745