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

Thomas Koenig tkoenig@alice-dsl.net
Sat Sep 1 20:26:00 GMT 2007


Asher Langton wrote:

Hi Asher,

> Here's an updated patch.  I've added -finit-character=<n>, where 0 <=
> n <= 127 is an ASCII value.  Derived types aren't initialized, but
> I've documented this in the manual.  I've added a test that checks
> initialization of SAVE'd variables.  This has been bootstrapped (+make
> pdf) and regression tested on x86_64-unknown-linux-gnu.

Equivalenced variables are not initialized by your patch:

$ cat foo.f
      program main
      call foo
      end
      subroutine foo
      equivalence(i,j)
      print *,j
      end
$ g77 -finit-local-zero foo.f && ./a.out
 0
$ gfortran -finit-local-zero foo.f && ./a.out
           1

This behavior is different from g77, so I think it should be either
documented, or the behavior changed to match g77.  Of course, if the
user specifies -finit-integer and -finit-real and equivalences the
values, he's on his own :-)

	Thomas



More information about the Gcc-patches mailing list