public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "anlauf at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug fortran/102366] [10/11/12 Regression] large arrays no longer become static
Date: Fri, 17 Sep 2021 18:33:12 +0000	[thread overview]
Message-ID: <bug-102366-4-2vffCtbGrC@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-102366-4@http.gcc.gnu.org/bugzilla/>

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.

  parent reply	other threads:[~2021-09-17 18:33 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-16 13:53 [Bug fortran/102366] New: [10/11/12 Regression] Illegal instruction with large arrays dominiq at lps dot ens.fr
2021-09-16 13:58 ` [Bug fortran/102366] " iains at gcc dot gnu.org
2021-09-16 18:55 ` anlauf at gcc dot gnu.org
2021-09-16 19:14 ` dominiq at lps dot ens.fr
2021-09-16 19:18 ` jakub at gcc dot gnu.org
2021-09-16 19:23 ` iains at gcc dot gnu.org
2021-09-16 19:30 ` jakub at gcc dot gnu.org
2021-09-16 19:59 ` anlauf at gcc dot gnu.org
2021-09-16 20:15 ` anlauf at gcc dot gnu.org
2021-09-16 21:16 ` anlauf at gcc dot gnu.org
2021-09-16 22:45 ` [Bug fortran/102366] [10/11/12 Regression] large arrays no longer become static pinskia at gcc dot gnu.org
2021-09-17  9:50 ` dominiq at lps dot ens.fr
2021-09-17 18:33 ` anlauf at gcc dot gnu.org [this message]
2021-09-17 18:35 ` jakub at gcc dot gnu.org
2021-09-17 18:56 ` anlauf at gcc dot gnu.org
2021-09-17 19:46 ` cvs-commit at gcc dot gnu.org
2021-09-17 20:04 ` anlauf at gcc dot gnu.org
2021-09-21 18:41 ` cvs-commit at gcc dot gnu.org
2021-09-21 18:47 ` cvs-commit at gcc dot gnu.org
2021-09-21 18:48 ` anlauf at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-102366-4-2vffCtbGrC@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).