Fortran: error recovery on invalid array section [PR108609]
The testcase for PR108527 uncovered a latent issue with invalid array sections that resulted in different paths being taken on different architectures. Detect the invalid array declaration for a clean recovery. gcc/fortran/ChangeLog: PR fortran/108609 * expr.cc (find_array_section): Add check to prevent interpreting an mpz non-integer constant as an integer. gcc/testsuite/ChangeLog: PR fortran/108609 * gfortran.dg/pr108527.f90: Adjust test pattern.
This commit is contained in:
parent
a2c848c92c
commit
88a2a09dd4
2 changed files with 6 additions and 2 deletions
|
@ -1552,7 +1552,11 @@ find_array_section (gfc_expr *expr, gfc_ref *ref)
|
|||
lower = ref->u.ar.as->lower[d];
|
||||
upper = ref->u.ar.as->upper[d];
|
||||
|
||||
if (!lower || !upper)
|
||||
if (!lower || !upper
|
||||
|| lower->expr_type != EXPR_CONSTANT
|
||||
|| upper->expr_type != EXPR_CONSTANT
|
||||
|| lower->ts.type != BT_INTEGER
|
||||
|| upper->ts.type != BT_INTEGER)
|
||||
{
|
||||
t = false;
|
||||
goto cleanup;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
program p
|
||||
integer, parameter :: a((2.)) = [4,8] ! { dg-error "must be of INTEGER type" }
|
||||
integer(a(1:1)) :: b ! { dg-error "out of bounds" }
|
||||
integer(a(1:1)) :: b ! { dg-error "Unclassifiable statement" }
|
||||
end
|
||||
|
||||
! { dg-prune-output "Parameter array" }
|
||||
|
|
Loading…
Add table
Reference in a new issue