http://gcc.gnu.org/bugzilla/show_bug.cgi?id=57262
--- Comment #2 from Tobias Burnus <burnus at gcc dot gnu.org> --- Created attachment 30105 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30105&action=edit Draft patch (trans-intrinsic.c only, ubound/lbound only, untested) PATCH: Draft patch for the second case (i.e. after the bound check) - only handles LBOUND/UBOUND. For SIZE, it only matters with inlining (which is done on the Fortran-dev branch); thus, this part is left out. TODO: Testing, test case and simplify.c handling. (In reply to Dominique d'Humieres from comment #1) > What is expected if i (jjj) /= 1? Well, the whole bug is only for rank == 1 array! Thus, using, e.g., jjj == 2 will be invalid (according to the Fortran standard) and will access invalid memory. With my (untested!) attached patch, jjj=2 should still give a run-time error for -fcheck=all. (And without, it accesses the bounds for dim=1 instead of invalid memory.) For the first test case (patch to be written), you will loose the run-time bounds check. Sorry!