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

Tobias Burnus <burnus at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu.org

--- Comment #3 from Tobias Burnus <burnus at gcc dot gnu.org> 2011-06-06 
08:22:53 UTC ---
(In reply to comment #2)
> The following aborts.  Note sure if it is conforming.

* ifort (also w/ "-stand f03 -warn all") and PGI accept it - and have the
expected value

* NAG 5.1 and g95 have %d == 0, i.e. the explicit DATA initialization prevents
the default initialization of trlkold.

* pathf95/openf95/crayftn/sunf95 reject the DATA because there is a default
initialization


It's actually a difficult to see whether it is invalid or not. However, I think
the code is valid (taking the side of NAG and g95): One does not do any double
initialization. From the F2008 standard:

"If a nonpointer object has default initialization, it shall not appear in a
data-stmt-object-list." (5.4.7 DATA statement) -- Does not seem to apply as
"trlkold%v" is not default initialized.

"5.2.3 Initialization":
"Explicit initialization alternatively may be specified in a DATA statement
unless the variable is of a derived type for which default initialization is
specified." -- Ditto.
"A variable, or part of a variable, shall not be explicitly initialized more
than once in a program." -- Also this is not violated.


Hence, it seems to be valid, but I wouldn't mind if someone could cross check,
given that most compilers don't generate the expected result - and given that
reading the standard can be difficult. [Even J3/WG5 members might read it
differently.]

Reply via email to