public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug fortran/98411] New: [10/11] Pointless: Array larger than ‘-fmax-stack-var-size=’, moved from stack to static storage for main program variables
@ 2020-12-21 11:25 vladimir.fuka at gmail dot com
  2020-12-21 21:41 ` [Bug fortran/98411] " anlauf at gcc dot gnu.org
                   ` (18 more replies)
  0 siblings, 19 replies; 20+ messages in thread
From: vladimir.fuka at gmail dot com @ 2020-12-21 11:25 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 98411
           Summary: [10/11] Pointless: Array larger than
                    ‘-fmax-stack-var-size=’, moved from stack to static
                    storage for main program variables
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vladimir.fuka at gmail dot com
  Target Milestone: ---

This program


program p
  dimension a(100000)
  call random_number(a)
  print *,a
end

causes

static.f90:2:13:

    2 |   dimension a(100000)
      |             1
Warning: Array ‘a’ at (1) is larger than limit set by ‘-fmax-stack-var-size=’,
moved from stack to static storage. This makes the procedure unsafe when called
recursively, or concurrently from multiple threads. Consider using
‘-frecursive’, or increase the ‘-fmax-stack-var-size=’ limit, or change the
code to use an ALLOCATABLE array. [-Wsurprising]


This warning is pointless because there are no procedures in the code and main
program arrays are SAVE already. There is no point using -frecursive or doing
anything to the stack. It causes active harm by causing confusion
https://stackoverflow.com/questions/65384213/using-very-large-arrays-in-fortran-gfortran/65391732#65391732

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Bug fortran/98411] [10/11] Pointless: Array larger than ‘-fmax-stack-var-size=’, moved from stack to static storage for main program variables
  2020-12-21 11:25 [Bug fortran/98411] New: [10/11] Pointless: Array larger than ‘-fmax-stack-var-size=’, moved from stack to static storage for main program variables vladimir.fuka at gmail dot com
@ 2020-12-21 21:41 ` anlauf at gcc dot gnu.org
  2020-12-21 21:41 ` anlauf at gcc dot gnu.org
                   ` (17 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: anlauf at gcc dot gnu.org @ 2020-12-21 21:41 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2020-12-21

--- Comment #1 from anlauf at gcc dot gnu.org ---
Confirmed.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Bug fortran/98411] [10/11] Pointless: Array larger than ‘-fmax-stack-var-size=’, moved from stack to static storage for main program variables
  2020-12-21 11:25 [Bug fortran/98411] New: [10/11] Pointless: Array larger than ‘-fmax-stack-var-size=’, moved from stack to static storage for main program variables 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
                   ` (16 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: anlauf at gcc dot gnu.org @ 2020-12-21 21:41 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P4
                 CC|                            |anlauf at gcc dot gnu.org

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Bug fortran/98411] [10/11] Pointless: Array larger than ‘-fmax-stack-var-size=’, moved from stack to static storage for main program variables
  2020-12-21 11:25 [Bug fortran/98411] New: [10/11] Pointless: Array larger than ‘-fmax-stack-var-size=’, moved from stack to static storage for main program variables 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
                   ` (15 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: jellby at yahoo dot com @ 2021-02-24 14:58 UTC (permalink / raw)
  To: gcc-bugs

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

Ignacio Fernández Galván <jellby at yahoo dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jellby at yahoo dot com

--- Comment #2 from Ignacio Fernández Galván <jellby at yahoo dot com> ---
May I add that it's probably similarly pointless to issue this warning for
large arrays in a module (as module variables, not in a procedure)?

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Bug fortran/98411] [10/11] Pointless: Array larger than ‘-fmax-stack-var-size=’, moved from stack to static storage for main program variables
  2020-12-21 11:25 [Bug fortran/98411] New: [10/11] Pointless: Array larger than ‘-fmax-stack-var-size=’, moved from stack to static storage for main program variables vladimir.fuka at gmail dot com
                   ` (2 preceding siblings ...)
  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
                   ` (14 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: ryofurue at gmail dot com @ 2021-05-08 13:42 UTC (permalink / raw)
  To: gcc-bugs

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

Ryo Furue <ryofurue at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ryofurue at gmail dot com

--- Comment #3 from Ryo Furue <ryofurue at gmail dot com> ---
(In reply to Ignacio Fernández Galván from comment #2)
> May I add that it's probably similarly pointless to issue this warning for
> large arrays in a module (as module variables, not in a procedure)?

Below is an example, which gives the warning in question with "-Wall" for a
module variable.

(I thought that adding SAVE were a recipe to ensure static allocation, and I've
been frantically searching the Internet to understand why gfortran tries to
allocate the module variable on the stack.)

I use GNU Fortran (Homebrew GCC 10.2.0_4) 10.2.0 on macOS 11.3.1 .

````
module try
  real(8), save:: a(10000000)
contains
  subroutine initmodule
    a(1) = 3.14
  end subroutine initmodule
end module try
````

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Bug fortran/98411] [10/11] Pointless: Array larger than ‘-fmax-stack-var-size=’, moved from stack to static storage for main program variables
  2020-12-21 11:25 [Bug fortran/98411] New: [10/11] Pointless: Array larger than ‘-fmax-stack-var-size=’, moved from stack to static storage for main program variables vladimir.fuka at gmail dot com
                   ` (3 preceding siblings ...)
  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
                   ` (13 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-05-09 21:27 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |anlauf at gcc dot gnu.org
   Target Milestone|---                         |10.4
      Known to work|                            |9.3.1
      Known to fail|                            |10.3.1, 11.1.1

--- Comment #4 from anlauf at gcc dot gnu.org ---
Patch to silence the warning (which was introduced with r10-4521):

diff --git a/gcc/fortran/trans-decl.c b/gcc/fortran/trans-decl.c
index cc9d85543ca..12e3ca0d811 100644
--- a/gcc/fortran/trans-decl.c
+++ b/gcc/fortran/trans-decl.c
@@ -738,6 +738,7 @@ 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->attr.automatic
+      && sym->attr.save != SAVE_EXPLICIT
       && 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.  */

Regtests ok.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Bug fortran/98411] [10/11] Pointless: Array larger than ‘-fmax-stack-var-size=’, moved from stack to static storage for main program variables
  2020-12-21 11:25 [Bug fortran/98411] New: [10/11] Pointless: Array larger than ‘-fmax-stack-var-size=’, moved from stack to static storage for main program variables vladimir.fuka at gmail dot com
                   ` (4 preceding siblings ...)
  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
                   ` (12 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-05-10 14:35 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |anlauf at gcc dot gnu.org

--- Comment #5 from anlauf at gcc dot gnu.org ---
Patch: https://gcc.gnu.org/pipermail/fortran/2021-May/056017.html

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Bug fortran/98411] [10/11] Pointless: Array larger than ‘-fmax-stack-var-size=’, moved from stack to static storage for main program variables
  2020-12-21 11:25 [Bug fortran/98411] New: [10/11] Pointless: Array larger than ‘-fmax-stack-var-size=’, moved from stack to static storage for main program variables vladimir.fuka at gmail dot com
                   ` (5 preceding siblings ...)
  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
                   ` (11 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-05-17 19:36 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #6 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Harald Anlauf <anlauf@gcc.gnu.org>:

https://gcc.gnu.org/g:09867aa0ef7568012650395189b735f9a34cf9b5

commit r12-848-g09867aa0ef7568012650395189b735f9a34cf9b5
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Mon May 17 21:35:38 2021 +0200

    PR fortran/98411 - Pointless warning for static variables

    Variables with explicit SAVE attribute cannot end up on the stack.
    There is no point in checking whether they should be moved off the
    stack to static storage.

    gcc/fortran/ChangeLog:

            PR fortran/98411
            * trans-decl.c (gfc_finish_var_decl): Add check for explicit SAVE
            attribute.

    gcc/testsuite/ChangeLog:

            PR fortran/98411
            * gfortran.dg/pr98411.f90: New test.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Bug fortran/98411] [10/11] Pointless: Array larger than ‘-fmax-stack-var-size=’, moved from stack to static storage for main program variables
  2020-12-21 11:25 [Bug fortran/98411] New: [10/11] Pointless: Array larger than ‘-fmax-stack-var-size=’, moved from stack to static storage for main program variables vladimir.fuka at gmail dot com
                   ` (6 preceding siblings ...)
  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
                   ` (10 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: vladimir.fuka at gmail dot com @ 2021-05-17 21:14 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #7 from Vladimir Fuka <vladimir.fuka at gmail dot com> ---
This sounds like good progress and I thank you for the patch. However,
shouldn't implicitly SAVE'd variables, as e.g. the program local variable in
the original report, be included as well?

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Bug fortran/98411] [10/11] Pointless: Array larger than ‘-fmax-stack-var-size=’, moved from stack to static storage for main program variables
  2020-12-21 11:25 [Bug fortran/98411] New: [10/11] Pointless: Array larger than ‘-fmax-stack-var-size=’, moved from stack to static storage for main program variables vladimir.fuka at gmail dot com
                   ` (7 preceding siblings ...)
  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
                   ` (9 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-05-17 21:29 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #8 from anlauf at gcc dot gnu.org ---
(In reply to Vladimir Fuka from comment #7)
> This sounds like good progress and I thank you for the patch. However,
> shouldn't implicitly SAVE'd variables, as e.g. the program local variable in
> the original report, be included as well?

You are right.

However, note that implicit SAVE for the main was added by Tobias only in
r12-805,
so I might have to think about a follow-up to this one.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Bug fortran/98411] [10/11] Pointless: Array larger than ‘-fmax-stack-var-size=’, moved from stack to static storage for main program variables
  2020-12-21 11:25 [Bug fortran/98411] New: [10/11] Pointless: Array larger than ‘-fmax-stack-var-size=’, moved from stack to static storage for main program variables vladimir.fuka at gmail dot com
                   ` (8 preceding siblings ...)
  2021-05-17 21:29 ` anlauf at gcc dot gnu.org
@ 2021-05-18 20:20 ` anlauf at gcc dot gnu.org
  2021-05-28 18:10 ` cvs-commit at gcc dot gnu.org
                   ` (8 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-05-18 20:20 UTC (permalink / raw)
  To: gcc-bugs

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.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Bug fortran/98411] [10/11] Pointless: Array larger than ‘-fmax-stack-var-size=’, moved from stack to static storage for main program variables
  2020-12-21 11:25 [Bug fortran/98411] New: [10/11] Pointless: Array larger than ‘-fmax-stack-var-size=’, moved from stack to static storage for main program variables vladimir.fuka at gmail dot com
                   ` (9 preceding siblings ...)
  2021-05-18 20:20 ` anlauf at gcc dot gnu.org
@ 2021-05-28 18:10 ` cvs-commit at gcc dot gnu.org
  2021-05-28 18:19 ` cvs-commit at gcc dot gnu.org
                   ` (7 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-05-28 18:10 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Harald Anlauf
<anlauf@gcc.gnu.org>:

https://gcc.gnu.org/g:1e9e0798d2242b7908db4098136d0bfd0bc7f0e8

commit r11-8480-g1e9e0798d2242b7908db4098136d0bfd0bc7f0e8
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Mon May 17 21:35:38 2021 +0200

    PR fortran/98411 - Pointless warning for static variables

    Variables with explicit SAVE attribute cannot end up on the stack.
    There is no point in checking whether they should be moved off the
    stack to static storage.

    gcc/fortran/ChangeLog:

            PR fortran/98411
            * trans-decl.c (gfc_finish_var_decl): Add check for explicit SAVE
            attribute.

    gcc/testsuite/ChangeLog:

            PR fortran/98411
            * gfortran.dg/pr98411.f90: New test.

    (cherry picked from commit 09867aa0ef7568012650395189b735f9a34cf9b5)

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Bug fortran/98411] [10/11] Pointless: Array larger than ‘-fmax-stack-var-size=’, moved from stack to static storage for main program variables
  2020-12-21 11:25 [Bug fortran/98411] New: [10/11] Pointless: Array larger than ‘-fmax-stack-var-size=’, moved from stack to static storage for main program variables vladimir.fuka at gmail dot com
                   ` (10 preceding siblings ...)
  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
                   ` (6 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-05-28 18:19 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #11 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Harald Anlauf
<anlauf@gcc.gnu.org>:

https://gcc.gnu.org/g:799cf16051844f80d09526f17194373902254708

commit r10-9871-g799cf16051844f80d09526f17194373902254708
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Mon May 17 21:35:38 2021 +0200

    PR fortran/98411 - Pointless warning for static variables

    Variables with explicit SAVE attribute cannot end up on the stack.
    There is no point in checking whether they should be moved off the
    stack to static storage.

    gcc/fortran/ChangeLog:

            PR fortran/98411
            * trans-decl.c (gfc_finish_var_decl): Add check for explicit SAVE
            attribute.

    gcc/testsuite/ChangeLog:

            PR fortran/98411
            * gfortran.dg/pr98411.f90: New test.

    (cherry picked from commit 09867aa0ef7568012650395189b735f9a34cf9b5)

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Bug fortran/98411] [10/11] Pointless: Array larger than ‘-fmax-stack-var-size=’, moved from stack to static storage for main program variables
  2020-12-21 11:25 [Bug fortran/98411] New: [10/11] Pointless: Array larger than ‘-fmax-stack-var-size=’, moved from stack to static storage for main program variables vladimir.fuka at gmail dot com
                   ` (11 preceding siblings ...)
  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
                   ` (5 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: burnus at gcc dot gnu.org @ 2021-07-29 12:33 UTC (permalink / raw)
  To: gcc-bugs

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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org

--- Comment #12 from Tobias Burnus <burnus at gcc dot gnu.org> ---
Regarding the message:

Warning: Array ‘a’ at (1) is larger than limit set by ‘-fmax-stack-var-size=’,
moved from stack to static storage. This makes the procedure unsafe when called
recursively, or concurrently from multiple threads. Consider using
‘-frecursive’, or increase the ‘-fmax-stack-var-size=’ limit, or change the
code to use an ALLOCATABLE array. [-Wsurprising]

The -frecursive flag is fine - but highly misleading, until reading the
gfortran manual.
I think the last sentence should be something like:

"Consider increasing the ‘-fmax-stack-var-size=’ limit (or use -frecursive,
which implies unlimited -fmax-stack-var-size) - or change the code to use an
ALLOCATABLE array. If the variable is never accessed concurrently, this warning
can be ignored; in this case, the variable could also be declared with the SAVE
attribute."

Or differently worded - but -frecursive needs some explanation in the message.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Bug fortran/98411] [10/11/12 Regression] Pointless: Array larger than ‘-fmax-stack-var-size=’, moved from stack to static storage for main program variables
  2020-12-21 11:25 [Bug fortran/98411] New: [10/11] Pointless: Array larger than ‘-fmax-stack-var-size=’, moved from stack to static storage for main program variables vladimir.fuka at gmail dot com
                   ` (12 preceding siblings ...)
  2021-07-29 12:33 ` burnus at gcc dot gnu.org
@ 2021-07-29 19:15 ` anlauf at gcc dot gnu.org
  2021-08-04 21:11 ` anlauf at gcc dot gnu.org
                   ` (4 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-07-29 19:15 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|[10/11] Pointless: Array    |[10/11/12 Regression]
                   |larger than                 |Pointless: Array larger
                   |‘-fmax-stack-var-size=’,    |than
                   |moved from stack to static  |‘-fmax-stack-var-size=’,
                   |storage for main program    |moved from stack to static
                   |variables                   |storage for main program
                   |                            |variables

--- Comment #13 from anlauf at gcc dot gnu.org ---
(In reply to Tobias Burnus from comment #12)

Hi Tobias,

> The -frecursive flag is fine - but highly misleading, until reading the
> gfortran manual.
> I think the last sentence should be something like:
> 
> "Consider increasing the ‘-fmax-stack-var-size=’ limit (or use -frecursive,
> which implies unlimited -fmax-stack-var-size) - or change the code to use an
> ALLOCATABLE array. If the variable is never accessed concurrently, this
> warning can be ignored; in this case, the variable could also be declared
> with the SAVE attribute."

that should be easier to understand.  Do you want to take over this PR?

I still have the patch from comment#9 in my tree, fixing comment#0.
However, IIRC my debugging sessions had cases where we miss setting
an implicit save.  Unfortunately, those particular testcases are lost.

As a reminder: Fortran 2018:8.5.16(4) has:

"A variable, common block, or procedure pointer declared in the scoping unit
of a main program, module, or submodule implicitly has the SAVE attribute,
which may be confirmed by explicit specification. If a common block has the
SAVE attribute in any other kind of scoping unit, it shall have the SAVE
attribute in every scoping unit that is not of a main program, module, or
submodule."

As a minimal solution we could combine the patch in comment#9 with the
textual change from comment#12 and defer the handling of implicit save.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Bug fortran/98411] [10/11/12 Regression] Pointless: Array larger than ‘-fmax-stack-var-size=’, moved from stack to static storage for main program variables
  2020-12-21 11:25 [Bug fortran/98411] New: [10/11] Pointless: Array larger than ‘-fmax-stack-var-size=’, moved from stack to static storage for main program variables vladimir.fuka at gmail dot com
                   ` (13 preceding siblings ...)
  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
                   ` (3 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-08-04 21:11 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to fail|                            |12.0

--- Comment #14 from anlauf at gcc dot gnu.org ---
Patch part 2: https://gcc.gnu.org/pipermail/fortran/2021-August/056316.html

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Bug fortran/98411] [10/11/12 Regression] Pointless: Array larger than ‘-fmax-stack-var-size=’, moved from stack to static storage for main program variables
  2020-12-21 11:25 [Bug fortran/98411] New: [10/11] Pointless: Array larger than ‘-fmax-stack-var-size=’, moved from stack to static storage for main program variables vladimir.fuka at gmail dot com
                   ` (14 preceding siblings ...)
  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
                   ` (2 subsequent siblings)
  18 siblings, 0 replies; 20+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-08-24 19:08 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #15 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Harald Anlauf <anlauf@gcc.gnu.org>:

https://gcc.gnu.org/g:f95946afd160e2a1f4beac4ee5e6d5633307f39a

commit r12-3129-gf95946afd160e2a1f4beac4ee5e6d5633307f39a
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Tue Aug 24 21:07:50 2021 +0200

    Fortran: fix pointless warning for static variables

    gcc/fortran/ChangeLog:

            PR fortran/98411
            * trans-decl.c (gfc_finish_var_decl): Adjust check to handle
            implicit SAVE as well as variables in the main program.  Improve
            warning message text.

    gcc/testsuite/ChangeLog:

            PR fortran/98411
            * gfortran.dg/pr98411.f90: Adjust testcase options to restrict to
            F2008, and verify case of implicit SAVE.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Bug fortran/98411] [10/11/12 Regression] Pointless: Array larger than ‘-fmax-stack-var-size=’, moved from stack to static storage for main program variables
  2020-12-21 11:25 [Bug fortran/98411] New: [10/11] Pointless: Array larger than ‘-fmax-stack-var-size=’, moved from stack to static storage for main program variables vladimir.fuka at gmail dot com
                   ` (15 preceding siblings ...)
  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
  18 siblings, 0 replies; 20+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-08-26 18:43 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #16 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-11 branch has been updated by Harald Anlauf
<anlauf@gcc.gnu.org>:

https://gcc.gnu.org/g:65ff948e6f8a257ad593256715004eaa41c27011

commit r11-8932-g65ff948e6f8a257ad593256715004eaa41c27011
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Tue Aug 24 21:07:50 2021 +0200

    Fortran: fix pointless warning for static variables

    gcc/fortran/ChangeLog:

            PR fortran/98411
            * trans-decl.c (gfc_finish_var_decl): Adjust check to handle
            implicit SAVE as well as variables in the main program.  Improve
            warning message text.

    gcc/testsuite/ChangeLog:

            PR fortran/98411
            * gfortran.dg/pr98411.f90: Adjust testcase options to restrict to
            F2008, and verify case of implicit SAVE.

    (cherry picked from commit f95946afd160e2a1f4beac4ee5e6d5633307f39a)

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Bug fortran/98411] [10/11/12 Regression] Pointless: Array larger than ‘-fmax-stack-var-size=’, moved from stack to static storage for main program variables
  2020-12-21 11:25 [Bug fortran/98411] New: [10/11] Pointless: Array larger than ‘-fmax-stack-var-size=’, moved from stack to static storage for main program variables vladimir.fuka at gmail dot com
                   ` (16 preceding siblings ...)
  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
  18 siblings, 0 replies; 20+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2021-08-26 18:52 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #17 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Harald Anlauf
<anlauf@gcc.gnu.org>:

https://gcc.gnu.org/g:d9887f6d99fe435dd63e1c0eefa820b24c7f4100

commit r10-10071-gd9887f6d99fe435dd63e1c0eefa820b24c7f4100
Author: Harald Anlauf <anlauf@gmx.de>
Date:   Tue Aug 24 21:07:50 2021 +0200

    Fortran: fix pointless warning for static variables

    gcc/fortran/ChangeLog:

            PR fortran/98411
            * trans-decl.c (gfc_finish_var_decl): Adjust check to handle
            implicit SAVE as well as variables in the main program.  Improve
            warning message text.

    gcc/testsuite/ChangeLog:

            PR fortran/98411
            * gfortran.dg/pr98411.f90: Adjust testcase options to restrict to
            F2008, and verify case of implicit SAVE.

    (cherry picked from commit f95946afd160e2a1f4beac4ee5e6d5633307f39a)

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [Bug fortran/98411] [10/11/12 Regression] Pointless: Array larger than ‘-fmax-stack-var-size=’, moved from stack to static storage for main program variables
  2020-12-21 11:25 [Bug fortran/98411] New: [10/11] Pointless: Array larger than ‘-fmax-stack-var-size=’, moved from stack to static storage for main program variables vladimir.fuka at gmail dot com
                   ` (17 preceding siblings ...)
  2021-08-26 18:52 ` cvs-commit at gcc dot gnu.org
@ 2021-08-26 18:56 ` anlauf at gcc dot gnu.org
  18 siblings, 0 replies; 20+ messages in thread
From: anlauf at gcc dot gnu.org @ 2021-08-26 18:56 UTC (permalink / raw)
  To: gcc-bugs

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

anlauf at gcc dot gnu.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
         Resolution|---                         |FIXED

--- Comment #18 from anlauf at gcc dot gnu.org ---
Should be fixed now.

The warning message has been adjusted following the recommendation of Tobias.

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2021-08-26 18:56 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-21 11:25 [Bug fortran/98411] New: [10/11] Pointless: Array larger than ‘-fmax-stack-var-size=’, moved from stack to static storage for main program variables 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
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

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).