------- Comment #2 from burnus at gcc dot gnu dot org  2008-10-16 09:37 -------
Regarding -fno-automatic, James Van Buskirk suggested to compare the details
with ifort's -save (see URL above):

"The description in my admittedly old version of ifort documentation
allows for different semantics for ifort /Qsave and gfortran
-fno-automatic.  The former says only that it saves all variables in
static allocation except local variables within a recursive routine
and variables declare as AUTOMATIC.  This is not the same as treating
every program unit except those marked as RECURSIVE as if the SAVE
statement were specified for every local variable and array
referenced in it.  For example ifort leaves open the possibility
of reinitializing instances of user-defined types with default
initialization and gfortran does not.  This on the one hand permits
standard-conforming code to behave the same way with /Qsave specified
whereas the change should be detectable for -fno-automatic but on
the other hand creates an ambiguity as to whether ifort actually does
leave the semantics of standard-conforming code intact as it doesn't
say whether it does or not in the documentation.

It might be useful for the gfortran team to compare with ifort and
determine whether they want to maintain semantics of standard-conforming
code before considering failure to change semantics to be a bug.  Of
course the documentation would have to be rewritten if the decision
were made to change the behavior.  Sometimes it's just so difficult to
rewrite the documentation that a documented bad behavior gets left
intact.  For example in the original f90 standard, non-advancing I/O
was specified to advance on format reversion due to a carry-over from
f77 that had no non-advancing I/O.  I imagine everyone tries to write
non-advancing I/O taking for granted that format reversion also does
not advance to the next record and indeed early f90 compilers behaved
in just this way.  However the simply-worded standard says otherwise
and rather than fix this bug in the standard the compilers got 'fixed'
so that now format reversion is just useless in conjunction with non-
advancing I/O."

Wording of gfortran:
http://gcc.gnu.org/onlinedocs/gfortran/Code-Gen-Options.html

Wording of ifort:
"This option saves all variables in static allocation except local variables
within a recursive routine and variables declared as AUTOMATIC."
http://www.intel.com/software/products/compilers/docs/flin/main_for/mergedProjects/copts_for/fortran_options/option_save.htm

I think gfortran's wording implies that derived-types are SAVEd, ifort's is a
bit more ambiguous, but ifort does the do so. Thus I think it might be enough
to fix the 'bug' as stated in comment 0.


-- 


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

Reply via email to