diff options
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/fortran/check.c | 3 | ||||
-rw-r--r-- | gcc/testsuite/gfortran.dg/pr95585.f90 | 6 |
2 files changed, 8 insertions, 1 deletions
diff --git a/gcc/fortran/check.c b/gcc/fortran/check.c index 9c95524..de9a45f 100644 --- a/gcc/fortran/check.c +++ b/gcc/fortran/check.c @@ -4742,7 +4742,8 @@ gfc_check_reshape (gfc_expr *source, gfc_expr *shape, && shape->ref->u.ar.as->lower[0]->ts.type == BT_INTEGER && shape->ref->u.ar.as->upper[0]->expr_type == EXPR_CONSTANT && shape->ref->u.ar.as->upper[0]->ts.type == BT_INTEGER - && shape->symtree->n.sym->attr.flavor == FL_PARAMETER) + && shape->symtree->n.sym->attr.flavor == FL_PARAMETER + && shape->symtree->n.sym->value) { int i, extent; gfc_expr *e, *v; diff --git a/gcc/testsuite/gfortran.dg/pr95585.f90 b/gcc/testsuite/gfortran.dg/pr95585.f90 new file mode 100644 index 0000000..b0e6cdc --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr95585.f90 @@ -0,0 +1,6 @@ +! { dg-do compile } + +program test + integer, parameter :: a(2) = reshape([1, 2], a) ! { dg-error "before its definition" } +end program + |