------- Comment #3 from fxcoudert at gcc dot gnu dot org 2006-05-24 09:20
-------
> function F()
> integer :: F(1)
> f = 1
> end function F
Compiling this simple function without and with -fbounds-check and dumping the
GIMPLE tree generated gives the following diff:
--- 003t.original.noboundscheck 2006-05-24 11:09:37.000000000 +0200
+++ 003t.original.boundscheck 2006-05-24 11:09:32.000000000 +0200
@@ -14,8 +14,16 @@ f (__result)
D.917 = __result->dim[0].stride;
stride.0 = D.917 == 0 ? 1 : D.917;
__result.0 = (int4[0:D.918] *) __result->data;
+ if ((logical4) __builtin_expect (__result->dim[0].ubound !=
__result->dim[0].lbound, 0))
+ {
+ _gfortran_runtime_error ("Array bound mismatch", "test.f90", 1);
+ }
+ else
+ {
+ (void) 0;
+ }
size.2 = NON_LVALUE_EXPR <stride.0>;
- offset.1 = -stride.0;
+ offset.1 = __result->dim[0].lbound - __result->dim[0].ubound;
D.918 = size.2 - 1;
D.919 = (bit_size_type) (<unnamed type>) size.2 *
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.
--
fxcoudert at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Last reconfirmed|2006-05-19 16:59:16 |2006-05-24 09:20:48
date| |
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27524