This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/85364] -fopenmp should not put array in program on the stack
- From: "tkoenig at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 12 Apr 2018 20:56:03 +0000
- Subject: [Bug fortran/85364] -fopenmp should not put array in program on the stack
- Auto-submitted: auto-generated
- References: <bug-85364-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85364
Thomas Koenig <tkoenig at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Keywords| |wrong-code
--- Comment #2 from Thomas Koenig <tkoenig at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #1)
> -fopenmp just implies -frecursive and has to, because the OpenMP semantics
> requires it.
> Does fortran guarantee that MAIN__ can't be invoked more than once?
Yes, it is not possible (from the language) to call a main program.
> If so,
> perhaps MAIN__ could be special-cased for -frecursive, you'd need to update
> the docs too. There would be no way to force automatic variables in MAIN__
> though if the user wants it for some reason (you can't mark MAIN__
> RECURSIVE).
Since F2008, all variables in the main program have the SAVE
attribute anyway (F2008, 5.3.16, para 4).
Earlier versions left this unspecified; in F2003, the standard says
"The SAVE attribute may appear in declarations in a main program and has no
effect."
which makes sense because there is no way the user can tell
the difference except by using valgrind on allocatable arrays.
So (methinks) we should be safe making those SAVEd as well.