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: 12 Oct 2007 20:20:24 -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 #2 from burnus at gcc dot gnu dot org 2007-10-12 20:20 -------
There is another bug (accepts-invalid):
integer, intent(out) :: jp(2,*)
jp(3,2:4)=0
which is not diagnosed at compile time.
The wrong-code bug is fixed by the followed patch.
Index: trans-array.c
===================================================================
--- trans-array.c (revision 129272)
+++ trans-array.c (working copy)
@@ -2870,7 +2870,7 @@ gfc_conv_ss_startstride (gfc_loopinfo *
if (info->ref->u.ar.dimen_type[dim] != DIMEN_RANGE)
continue;
- if (n == info->ref->u.ar.dimen - 1
+ if (n == info->ref->u.ar.dimen - 2
&& (info->ref->u.ar.as->type == AS_ASSUMED_SIZE
|| info->ref->u.ar.as->cp_was_assumed))
check_upper = false;
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33745