This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH, fortran] PR20441 -finit-local-zero


On 8/20/07, Tobias Burnus <burnus@net-b.de> wrote:
> 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" ...

Hi Tobias,

Thanks for the feedback.  I'll take a look at this and see what I can do.

> PS: I wonder whether it makes sense to have -finit-character=c to
> initially character variables with, e.g. "XXXXXXXXXXXXXXXXXXXX".

It makes sense, but I left it out because I didn't know if anyone
would find it useful.  I can easily add an finit-character option,
though.

-Asher


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]