[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

2021-08-26 Thread anlauf at gcc dot gnu.org via 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.

[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

2021-08-26 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98411

--- Comment #17 from CVS Commits  ---
The releases/gcc-10 branch has been updated by Harald Anlauf
:

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

commit r10-10071-gd9887f6d99fe435dd63e1c0eefa820b24c7f4100
Author: Harald Anlauf 
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)

[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

2021-08-26 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98411

--- Comment #16 from CVS Commits  ---
The releases/gcc-11 branch has been updated by Harald Anlauf
:

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

commit r11-8932-g65ff948e6f8a257ad593256715004eaa41c27011
Author: Harald Anlauf 
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)

[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

2021-08-24 Thread cvs-commit at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98411

--- Comment #15 from CVS Commits  ---
The master branch has been updated by Harald Anlauf :

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

commit r12-3129-gf95946afd160e2a1f4beac4ee5e6d5633307f39a
Author: Harald Anlauf 
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.

[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

2021-08-04 Thread anlauf at gcc dot gnu.org via 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

[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

2021-07-29 Thread anlauf at gcc dot gnu.org via 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.