Legacy ASSIGN requires a scalar integer variable. Reject parameter
arguments.
gcc/fortran/
PR fortran/96085
* resolve.c (gfc_resolve_code): Check whether assign target is a
parameter.
|| code->expr1->symtree->n.sym->ts.type != BT_INTEGER
|| code->expr1->symtree->n.sym->ts.kind
!= gfc_default_integer_kind
+ || code->expr1->symtree->n.sym->attr.flavor == FL_PARAMETER
|| code->expr1->symtree->n.sym->as != NULL))
gfc_error ("ASSIGN statement at %L requires a scalar "
"default INTEGER variable", &code->expr1->where);
--- /dev/null
+! { dg-do compile }
+! { dg-options "-std=legacy" }
+! PR fortran/96085 - ICE in gfc_finish_var_decl, at fortran/trans-decl.c:694
+
+module m
+ integer, parameter :: a = 1
+contains
+ subroutine s
+ assign 2 to a ! { dg-error "requires a scalar default INTEGER variable" }
+2 print *, a
+ end
+end