http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31119



--- Comment #8 from Joost VandeVondele <Joost.VandeVondele at mat dot ethz.ch> 
2012-10-20 14:59:08 UTC ---

(In reply to comment #7)

> Hi,

> can someone fortran aware please double-check that the tests

> 

>     * gfortran.dg/bounds_check_9.f90: New test.

>     * gfortran.dg/bounds_check_fail_2.f90: New test.

> 

> do not contain out of bounds access?  I am working on path to bound number of

> loop iterations better based on array accesses and what I see is array A.9

> containing values {1,2} that is accessed in the loop header.

> We bound number of iterations of that loop to 1 (that is one loopback edge

> iteration to walk both parts of the array) and then the testcases start

> failing.

> 

> I do not understand the testcase.

> Perhaps the bounds-check instrumentation happens too late or we need to 
> disable

> this logic with -fbounds-check?

> 

> Honza



According to me, the first testcase (bounds_check_9.f90) should contain no

out-of-bounds access (at least from the fortran point of view, and also

according to valgrind), while the second testcase (bounds_check_fail_2.f90)

does contain out-of-bounds access (by design). Of course, -fbounds-check is

designed to catch out-of-bounds at runtime (which the second testcase tests).

Of course, fortran programs with out-of-bounds access are not standard

conforming. 



Actually, the situation is a bit bizarre. There are no conforming programs for

which bounds-checking can trigger... all these bounds-checking statements can

be just optimized away :-). That's not quite what the users want... I run

-fbounds-check -O2 quite often. I don't think one should switch off

optimization in the presence of -fbounds-check. Maybe the docs should be

enhanced and mention that bounds checking is most effective at -O0 ?

Reply via email to