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/98411] [10/11] Pointless: Array larger than ‘-fmax-stack-var-size=’, moved from stack to static storage for main program variables
Date: Tue, 18 May 2021 20:20:50 +0000	[thread overview]
Message-ID: <bug-98411-4-9DLQQLpAHC@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-98411-4@http.gcc.gnu.org/bugzilla/>

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98411

--- Comment #9 from anlauf at gcc dot gnu.org ---
(In reply to anlauf from comment #8)

Looking some more into this: I couldn't find a consistent concept of setting
variables to implicit-save as e.g. described in F2018 section 8.5.16 clause 4.

A hackish approach to fix the remaining part of this PR could look like

diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index 406b4aeb1d4..a2498a04fb9 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -737,8 +737,10 @@ 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
       && INTEGER_CST_P (DECL_SIZE_UNIT (decl))
       && !gfc_can_put_var_on_stack (DECL_SIZE_UNIT (decl))
         /* Put variable length auto array pointers always into stack.  */

However, the first part of this patch would only address variables in the main
program, and the second part needs proper setting of SAVE_IMPLICIT, which is
not yet done.

As a sidenote: the above would regtest ok and fix comment#0.

  parent reply	other threads:[~2021-05-18 20:20 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-21 11:25 [Bug fortran/98411] New: " vladimir.fuka at gmail dot com
2020-12-21 21:41 ` [Bug fortran/98411] " anlauf at gcc dot gnu.org
2020-12-21 21:41 ` anlauf at gcc dot gnu.org
2021-02-24 14:58 ` jellby at yahoo dot com
2021-05-08 13:42 ` ryofurue at gmail dot com
2021-05-09 21:27 ` anlauf at gcc dot gnu.org
2021-05-10 14:35 ` anlauf at gcc dot gnu.org
2021-05-17 19:36 ` cvs-commit at gcc dot gnu.org
2021-05-17 21:14 ` vladimir.fuka at gmail dot com
2021-05-17 21:29 ` anlauf at gcc dot gnu.org
2021-05-18 20:20 ` anlauf at gcc dot gnu.org [this message]
2021-05-28 18:10 ` cvs-commit at gcc dot gnu.org
2021-05-28 18:19 ` cvs-commit at gcc dot gnu.org
2021-07-29 12:33 ` burnus at gcc dot gnu.org
2021-07-29 19:15 ` [Bug fortran/98411] [10/11/12 Regression] " anlauf at gcc dot gnu.org
2021-08-04 21:11 ` anlauf at gcc dot gnu.org
2021-08-24 19:08 ` cvs-commit at gcc dot gnu.org
2021-08-26 18:43 ` cvs-commit at gcc dot gnu.org
2021-08-26 18:52 ` cvs-commit at gcc dot gnu.org
2021-08-26 18:56 ` 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-98411-4-9DLQQLpAHC@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).