This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: [PATCH, fortran] PR20441 -finit-local-zero
- From: "Asher Langton" <langton2 at llnl dot gov>
- To: "Tobias Burnus" <burnus at net-b dot de>
- Cc: "fortran at gcc dot gnu dot org" <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 20 Aug 2007 10:48:08 -0700
- Subject: Re: [PATCH, fortran] PR20441 -finit-local-zero
- Dkim-signature: a=rsa-sha1; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=LEPz+iIiYjsRGi64vwmxfMZuhmC9jc/VRCNGMZXbFaX8BT1B/LrrI8zf+Ka2sGxenOXAdSvnTEX99HQWmPk/AH4IiMiz5AzHd1XDVpNyf0sWOf7ipKULDVwZziZfRW5jhw5TmrI9Ap5WG/ig+Od3DFsrLTovZSYpbR578v4sO70=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:sender:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references:x-google-sender-auth; b=bXsmBCS9KzStQv/c81mFC1PRwZi7aArw5gcYZQFpPg1iDb9R9tt524BBkZgtSXuC8xOlfsj7eMitk0+t2TMt7Rgo50mnkG91z4aZECmw24Gh1JLkqpvMkvZyRzQPZfgkB9v9r3KpndR5XP3LqFu1EXgNb5A7O7vV9b6aa3iyLEM=
- References: <1953a4560708171312u705f5bf4ie9d8ce645d2f02b6@mail.gmail.com> <46C9C1C0.6070107@net-b.de>
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