[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
anlauf at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Thu Jul 29 19:15:24 GMT 2021
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.
More information about the Gcc-bugs
mailing list