------- Comment #3 from burnus at gcc dot gnu dot org 2007-10-13 14:34 ------- (In reply to comment #2) > The wrong-code bug is fixed by the followed patch.
Actually, it is not. The problem is - both in the compile time and at the run time bound checking - the combination of element vs. array range. Results using current gfortran (w/o wrong patch): - jp(1:3,2:3): OK - compile-time warning and the run-time error - jp(2,3): OK - no error/warning - jp(3,1:2): No compile-time diagnostics of dimension 1 plus the following: - jp(2,1:2): Bogus run-time error for the upper bound The problem for the last two examples is: - loop->dimen = 1 (one array range "1:2") - info->ref->u.ar.dimen = 2 (total no. available dimensions 2) - n = 0, ..., loop->dimen - 1 Thus the check "n == info->ref->u.ar.dimen - 1" is never true although "n == 0" is the last dimension of an assumed-sized array. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33745