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.

Reply via email to