Fortran: error recovery on invalid ARRAY argument to FINDLOC [PR106986]
gcc/fortran/ChangeLog: PR fortran/106986 * simplify.cc (gfc_simplify_findloc): Do not try to simplify intrinsic FINDLOC when the ARRAY argument has a NULL shape. gcc/testsuite/ChangeLog: PR fortran/106986 * gfortran.dg/pr106986.f90: New test.
This commit is contained in:
parent
8dbb15bc2d
commit
5976fbf9d5
2 changed files with 9 additions and 0 deletions
|
@ -5895,6 +5895,7 @@ gfc_simplify_findloc (gfc_expr *array, gfc_expr *value, gfc_expr *dim,
|
|||
bool back_val = false;
|
||||
|
||||
if (!is_constant_array_expr (array)
|
||||
|| array->shape == NULL
|
||||
|| !gfc_is_constant_expr (dim))
|
||||
return NULL;
|
||||
|
||||
|
|
8
gcc/testsuite/gfortran.dg/pr106986.f90
Normal file
8
gcc/testsuite/gfortran.dg/pr106986.f90
Normal file
|
@ -0,0 +1,8 @@
|
|||
! { dg-do compile }
|
||||
! PR fortran/106986 - ICE in simplify_findloc_nodim
|
||||
! Contributed by G.Steinmetz
|
||||
|
||||
program p
|
||||
integer, parameter :: a(:) = [1] ! { dg-error "deferred shape" }
|
||||
print *, findloc (a, 1)
|
||||
end
|
Loading…
Add table
Reference in a new issue