http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59537

Dominique d'Humieres <dominiq at lps dot ens.fr> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |accepts-invalid
            Summary|"Automatic array cannot     |"An automatic object shall
                   |have an initializer", for   |not have the SAVE
                   |-finit-real and a SAVE      |attribute." is not
                   |statement present in        |diagnosed.
                   |subroutine                  |

--- Comment #3 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> Maybe related to the already fixed #51800?

The difference is that in pr51800 the array is a dummy argument, while here it
is an automatic array. Looking at the f2008 standard, I see

5.2 Type declaration statements

5.2.1 Syntax

...

C506 (R503) An initialization shall not appear if object-name is a dummy
argument, a function result, an object in a named common block unless the type
declaration is in a block data program unit, an object in blank common, an
allocatable variable, an external function, an intrinsic function, or an
automatic object.

...

5.2.2 Automatic data objects

An automatic data object is a nondummy data object with a type parameter or
array bound that depends on the value of a specication-expr that is not a
constant expression.

C513 An automatic object shall not have the SAVE attribute.

...

From the above gfortran is right to reject the code with initialization.

> Without the SAVE statement it compiles fine.

>From the above (C513) this is a bug, the code should give an error without/with
-finit-*.

Reply via email to