[RFC] Double initialization of variables (PR 50410, RFC patch)

Tobias Burnus burnus@net-b.de
Tue Oct 18 15:24:00 GMT 2011


Hello all,

which double intializations should gfortran allow?

With the attached patch, one only allows double DATA initialization, 
however, that causes regressions as it disallows to combine assignment 
initialization followed by DATA initialization.

In other words: It fails for the second dg-error in 
gfortran.dg/data_initialized.f90 as with the patch the case is always 
rejected.

On the other hand, with the current version, one gets an ICE for:

       subroutine one()
       type t1
        integer g
       end type t1
       type(t1) :: u=t1(1)
       data u%g /2/ ! { dg-error "is already initialized and may thus 
not be in the DATA statement" }
       print *, u%g
       end

Other compilers seem to support this - some print 1 and others print 2.

What do you think? Is the current patch OK, which rejects this? Or 
should one one try harder to also allow this kind of double initialization.


Tobias
-------------- next part --------------
A non-text attachment was scrubbed...
Name: data-init-diag.diff
Type: text/x-patch
Size: 5338 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20111018/2b816669/attachment.bin>


More information about the Fortran mailing list