[RFC] Question on gfortran extension
Jerry DeLisle
jvdelisle@verizon.net
Sat Nov 18 07:44:00 GMT 2006
Hi all,
In working on PR24978 I am looking at several test cases. Currently the
following test case is accepted by gfortran as an extension:
integer :: a
data a /5/
data a /8/
print '(3i6)', a
end
The result is that the variable 'a' is assigned the value 5 because that data
statement is the last to be resolved even though intuitively one might think the
last data statement ought to take effect. (Resolution occurs in reverse
statement order)
This extension really goes against the F95 Standard which does not allow
duplicate initialization. It is my opinion that this is a dangerous extension.
As implemented now, it only warns if one specifies -pedantic and errors if
given -std=f95 or -std=f2003. This can leave users open to inadvertent
duplicate initialization if they do not use the options.
I am wondering if we should keep this extension at all and if so should we at
least warn as default and error on -pedantic and/or -std=fxx?
Also, if we do keep this extension, should we keep the assignment given in the
last data statement rather than the first?
Regards,
Jerry
More information about the Fortran
mailing list