[PATCH, fortran] PR20441 -finit-local-zero
Tobias Burnus
burnus@net-b.de
Mon Aug 20 18:46:00 GMT 2007
Hi Asher,
Asher Langton wrote:
> Here's a patch to add -finit-local-zero,
Shouldn't also the derived variables be initialized?
type bar
real :: r
complex :: z
integer :: i
character(len=5) :: c
logical :: l
end type bar
type(bar) :: t
print *, t%r; print *, t%z; print *, t%i;
print *, t%c; print *, t%l
end
With ifort and sunf95 they are set to zero; with "openf95 -zerouv" they
are zero. NAG f95 gives partially zeros (?) but -nan works.
I therefore think that -finit* also should initialize those. Replacing
"integer :: i" by "integer :: i = 5" changes the behaviour of gfortran
(independent of the -finit* options): Not only "i" is initalized but all
other variables are initialized to zero. Using -finit-real=nan I would
still expect NAN and not "0.0" ...
Tobias
PS: I wonder whether it makes sense to have -finit-character=c to
initially character variables with, e.g. "XXXXXXXXXXXXXXXXXXXX".
More information about the Fortran
mailing list