+2019-06-20 Steven G. Kargl <kargl@gcc.gnu.org>
+
+ PR fortran/77632
+ * /decl.c (variable_decl): Mark a variable that is a target in pointer
+ initialization when in PROGRAM, MODULE, or SUBMODULE scope with an
+ implicit save.
+
2019-06-20 Steven G. Kargl <kargl@gcc.gnu.org>
PR fortran/86587
m = match_pointer_init (&initializer, 0);
if (m != MATCH_YES)
goto cleanup;
+
+ /* The target of a pointer initialization must have the SAVE
+ attribute. A variable in PROGRAM, MODULE, or SUBMODULE scope
+ is implicit SAVEd. Explicitly, set the SAVE_IMPLICIT value. */
+ if (initializer->expr_type == EXPR_VARIABLE
+ && initializer->symtree->n.sym->attr.save == SAVE_NONE
+ && (gfc_current_state () == COMP_PROGRAM
+ || gfc_current_state () == COMP_MODULE
+ || gfc_current_state () == COMP_SUBMODULE))
+ initializer->symtree->n.sym->attr.save = SAVE_IMPLICIT;
}
else if (gfc_match_char ('=') == MATCH_YES)
{