Issue an error where an array is used before its definition
instead of an ICE.
2020-06-22 Steven G. Kargl <kargl@gcc.gnu.org>
gcc/fortran/
PR fortran/95585
* check.c (gfc_check_reshape): Add check for a value when
the symbol has an attribute flavor FL_PARAMETER.
2020-06-22 Mark Eggleston <markeggleston@gcc.gnu.org>
gcc/testsuite/
PR fortran/95585
* gfortran.dg/pr95585.f90: New test.
&& 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;
--- /dev/null
+! { dg-do compile }
+
+program test
+ integer, parameter :: a(2) = reshape([1, 2], a) ! { dg-error "before its definition" }
+end program
+