http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31119
Mikael Morin <mikael at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mikael at gcc dot gnu.org --- Comment #10 from Mikael Morin <mikael at gcc dot gnu.org> 2012-10-21 13:52:35 UTC --- (In reply to comment #8) > 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... Well, if the middle-end is able to prove that the bounds checking code is useless, it may as well remove it. In the case of a bogus array access, that code is useful, so the middle-end shouldn't be able to prove that it isn't, and the it won't be removed. For the other case (code removed where it should stay) there is a bug in the compiler, but that's not what -fbounds-check is supposed to check ;-). Regarding the initial question: > 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? There should be none, as the -fbounds-check instrumentation is supposed to catch out of bounds early enough, so that the code is valid from a middle-end point of view.