This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libfortran/27524] -fbounds-check interacts with array function
- From: "fxcoudert at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 May 2006 20:52:54 -0000
- Subject: [Bug libfortran/27524] -fbounds-check interacts with array function
- References: <bug-27524-10601@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #4 from fxcoudert at gcc dot gnu dot org 2006-05-24 20:52 -------
(In reply to comment #3)
> I think the cuplrit here is gfc_trans_dummy_array_bias(), around line 3728
> (where the offset is built), although I'm not skilled enough in all this to
> understand how exactly to fix it.
OK, I think I made it. It's a typo, where the stride variable is used as a
temporary variable for creating a bounds-checking tree, but its value is needed
(and reused) later, leading to the bug.
Index: trans-array.c
===================================================================
--- trans-array.c (revision 113849)
+++ trans-array.c (working copy)
@@ -3564,7 +3564,7 @@
tree dumdesc;
tree tmp;
tree stmt;
- tree stride;
+ tree stride, stride2;
tree stmt_packed;
tree stmt_unpacked;
tree partial;
@@ -3711,9 +3711,9 @@
tmp = fold_build2 (MINUS_EXPR, gfc_array_index_type,
ubound, lbound);
- stride = build2 (MINUS_EXPR, gfc_array_index_type,
+ stride2 = build2 (MINUS_EXPR, gfc_array_index_type,
dubound, dlbound);
- tmp = fold_build2 (NE_EXPR, gfc_array_index_type, tmp, stride);
+ tmp = fold_build2 (NE_EXPR, gfc_array_index_type, tmp, stride2);
gfc_trans_runtime_check (tmp, gfc_strconst_bounds, &block);
}
}
--
fxcoudert at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
AssignedTo|unassigned at gcc dot gnu |fxcoudert at gcc dot gnu dot
|dot org |org
Status|NEW |ASSIGNED
Last reconfirmed|2006-05-24 09:20:48 |2006-05-24 20:52:53
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27524