https://gcc.gnu.org/bugzilla/show_bug.cgi?id=57360
kargl at gcc dot gnu.org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |kargl at gcc dot gnu.org
--- Comment #6 from kargl at gcc dot gnu.org ---
With this patch,
diff --git a/gcc/fortran/decl.cc b/gcc/fortran/decl.cc
index 503ecb8d9b5..abb3579893f 100644
--- a/gcc/fortran/decl.cc
+++ b/gcc/fortran/decl.cc
@@ -2278,7 +2278,12 @@ add_init_expr_to_sym (const char *name, gfc_expr
**initp, locus *var_locus)
sym->value = init;
if (sym->attr.save == SAVE_NONE)
- sym->attr.save = SAVE_IMPLICIT;
+ {
+ sym->attr.save = SAVE_IMPLICIT;
+ if (warn_surprising)
+ gfc_warning (OPT_Wsurprising, "Entity %qs at %L has an implicit "
+ "SAVE attribute", sym->name, &sym->declared_at);
+ }
*initp = NULL;
}
I see
% gfcx -o z a.f90 -Wsurprising && ./z
a.f90:2:13:
2 | integer :: i=1
| 1
Warning: Entity āiā at (1) has an implicit SAVE attribute [-Wsurprising]
1