Commit r15-7873 copy-pasted erroneous code containing a non-terminating
loop that did not progress its control variable, and a switch statement
with an unhandled case leading to a gcc_unreachable () with suitable input.
PR fortran/119118
gcc/fortran/ChangeLog:
* dependency.cc (contains_forall_index_p): Let loop over elements
of a constructor update its control variable. Handle REF_INQUIRY
in switch statement.
(gfc_contains_implied_index_p): Likewise.
gcc/testsuite/ChangeLog:
* gfortran.dg/bounds_check_26.f90: Update test.
case EXPR_STRUCTURE:
case EXPR_ARRAY:
for (c = gfc_constructor_first (expr->value.constructor);
- c; gfc_constructor_next (c))
+ c; c = gfc_constructor_next (c))
if (contains_forall_index_p (c->expr))
return true;
break;
break;
case REF_COMPONENT:
+ case REF_INQUIRY:
break;
case REF_SUBSTRING:
case EXPR_STRUCTURE:
case EXPR_ARRAY:
for (c = gfc_constructor_first (expr->value.constructor);
- c; gfc_constructor_next (c))
+ c; c = gfc_constructor_next (c))
if (gfc_contains_implied_index_p (c->expr))
return true;
break;
break;
case REF_COMPONENT:
+ case REF_INQUIRY:
break;
case REF_SUBSTRING:
print *, str(-n:11) ! 2 checked bounds
print *, len (str(-n:11)) ! 2 checked bounds
+ print *, str(-n*n%kind:sum(n-[0,n%kind])) ! 2 checked bounds
+
end program main
-! { dg-final { scan-tree-dump-times "Substring out of bounds:" 10 "original" } }
+! { dg-final { scan-tree-dump-times "Substring out of bounds:" 12 "original" } }