public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Harald Anlauf <anlauf@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r10-10140] Fortran - (large) arrays in the main shall be static Date: Tue, 21 Sep 2021 18:47:28 +0000 (GMT) [thread overview] Message-ID: <20210921184728.ACEA73858D39@sourceware.org> (raw) https://gcc.gnu.org/g:d3db5b1d23cbe4e4569e688a6dbc8b5b2c38588e commit r10-10140-gd3db5b1d23cbe4e4569e688a6dbc8b5b2c38588e Author: Harald Anlauf <anlauf@gmx.de> Date: Fri Sep 17 21:45:33 2021 +0200 Fortran - (large) arrays in the main shall be static gcc/fortran/ChangeLog: PR fortran/102366 * trans-decl.c (gfc_finish_var_decl): Disable the warning message for variables moved from stack to static storange if they are declared in the main, but allow the move to happen. gcc/testsuite/ChangeLog: PR fortran/102366 * gfortran.dg/pr102366.f90: New test. (cherry picked from commit 51166eb2c534692c3c7779def24f83c8c3811b98) Diff: --- gcc/fortran/trans-decl.c | 5 +++-- gcc/testsuite/gfortran.dg/pr102366.f90 | 9 +++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c index c7dec272037..8aa71ede989 100644 --- a/gcc/fortran/trans-decl.c +++ b/gcc/fortran/trans-decl.c @@ -736,7 +736,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 @@ -750,7 +749,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 " diff --git a/gcc/testsuite/gfortran.dg/pr102366.f90 b/gcc/testsuite/gfortran.dg/pr102366.f90 new file mode 100644 index 00000000000..d002f64a8ae --- /dev/null +++ b/gcc/testsuite/gfortran.dg/pr102366.f90 @@ -0,0 +1,9 @@ +! { dg-do compile } +! { dg-options "-fdump-tree-original -Wall" } +! { dg-final { scan-tree-dump-times "static real" 1 "original" } } +! PR fortran/102366 - large arrays no longer become static + +program p + real(kind=4) :: a(16776325) + a=1.0 +end
reply other threads:[~2021-09-21 18:47 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20210921184728.ACEA73858D39@sourceware.org \ --to=anlauf@gcc.gnu.org \ --cc=gcc-cvs@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: linkBe 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).