[Bug fortran/59537] No "Automatic array cannot have an initializer", for -finit-real without a SAVE statement present in subroutine
dominiq at lps dot ens.fr
gcc-bugzilla@gcc.gnu.org
Sun Mar 23 00:01:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59537
Dominique d'Humieres <dominiq at lps dot ens.fr> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|"An automatic object shall |No "Automatic array cannot
|not have the SAVE |have an initializer", for
|attribute." is not |-finit-real without a SAVE
|diagnosed. |statement present in
| |subroutine
--- Comment #5 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> real :: a(1:n)
> save
>
> in which case the "SAVE" statement should apply to all variables to which
> it can apply - that is _not_ to the automatic dummy argument "a".
You are right:
5.4.14 SAVE statement
...
1 A SAVE statement with a saved entity list speci
es the SAVE attribute
(5.3.16) for a list of entities. A SAVE statement without a saved entity list
is treated as though it contained the names of all allowed items in the same
scoping unit.
I thought that the SAVE statement applied to ALL local variables, my bad.
> Nonetheless, code that compiles without -finit-real should also compile
> with -finit-real, right?
I disagree: C506 states that automatic object cannot be initialized. What is
wrong is that it depends on the presence of the SAVE statement without a saved
entity list.
More information about the Gcc-bugs
mailing list