This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
[RFC] Question on gfortran extension
- From: Jerry DeLisle <jvdelisle at verizon dot net>
- To: Fortran List <fortran at gcc dot gnu dot org>
- Date: Fri, 17 Nov 2006 22:21:16 -0800
- Subject: [RFC] Question on gfortran extension
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