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

Tobias Burnus burnus@net-b.de
Wed Aug 29 10:45:00 GMT 2007


Hi,

Asher Langton wrote:
> For now, my inclination is to leave derived type initialization as a
> TODO and document the -finit-* limitations in the manual.  If that's
> acceptable, I'll put together a fresh patch with the added
> documentation, as well as an -finit-character option.
>   
I think this is ok. Anyway, most important is -finit-local-zero for old
programs which somehow assume that all local (scalar) variables are
zero. Users of type() are usually initializing them (as do most Fortran
9x users for all variables).

I think you patch does not touch static variables (SAVE) thus they may
not get default initialized. (The middle end seems to initialize them to
zero, though.) Maybe some note should be added to the documentation as
well - or not? (Same for COMMONs, were there is the additional problem
that there might be many common blocks in the file which makes it
effectively impossible to initialize those.)

One could also think of initializing INTENT(OUT) variables to make sure
the INTENT() is properly used - but better not with -finit-local-zero. (
-finit-local-zero helps with broken programs which don't have the
initialization, but may break invalid programs which want INTENT(INOUT)
but specified INTENT(OUT).)

Tobias



More information about the Fortran mailing list