[Bug fortran/102366] [10/11/12 Regression] large arrays no longer become static
anlauf at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Fri Sep 17 18:33:12 GMT 2021
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102366
--- Comment #11 from anlauf at gcc dot gnu.org ---
(In reply to Dominique d'Humieres from comment #10)
> The problem is gone if I revert r12-3129.
But then it regresses on pr98411. See for yourself compiling with -Wall.
Something like
diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index bed61e2325d..b022d818e82 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -743,7 +743,6 @@ gfc_finish_var_decl (tree decl, gfc_symbol * sym)
/* Keep variables larger than max-stack-var-size off stack. */
if (!(sym->ns->proc_name && sym->ns->proc_name->attr.recursive)
- && !(sym->ns->proc_name && sym->ns->proc_name->attr.is_main_program)
&& !sym->attr.automatic
&& sym->attr.save != SAVE_EXPLICIT
&& sym->attr.save != SAVE_IMPLICIT
@@ -757,7 +756,9 @@ gfc_finish_var_decl (tree decl, gfc_symbol * sym)
|| sym->attr.allocatable)
&& !DECL_ARTIFICIAL (decl))
{
- if (flag_max_stack_var_size > 0)
+ if (flag_max_stack_var_size > 0
+ && !(sym->ns->proc_name &&
+ sym->ns->proc_name->attr.is_main_program))
gfc_warning (OPT_Wsurprising,
"Array %qs at %L is larger than limit set by "
"%<-fmax-stack-var-size=%>, moved from stack to static "
disables the warning for arrays in the main.
More information about the Gcc-bugs
mailing list