[Bug fortran/34143] alloc_comp_constructor.f90 fails with -fdefault-integer-8

burnus at gcc dot gnu dot org gcc-bugzilla@gcc.gnu.org
Thu Nov 22 13:18:00 GMT 2007



------- Comment #6 from burnus at gcc dot gnu dot org  2007-11-22 13:18 -------
(In reply to comment #4)
> The Intel and Sun compilers complain that this code is not legal, because you
> can't do "x = mytype(yy, bar)" if yy is not allocated.

I cannot reproduce this with the Sun Compiler, only with ifort. Besides,
following the Fortran 2003 standard, I believe the program is valid.

"If a component of a derived type is allocatable, the corresponding constructor
expression shall either be a reference to the intrinsic function NULL with no
arguments, an allocatable entity of the same rank, or shall evaluate to an
entity of the same rank. If the expression is a reference to the intrinsic
function NULL, the corresponding component of the constructor has a status of
unallocated. If the expression is an allocatable entity, the corresponding
component of the constructor has the same allocation status as that allocatable
entity and, if it is allocated, the same dynamic type, bounds, and value;"

(Fortran 2003 standard, "4.5.9 Construction of derived-type values")


-- 

burnus at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |burnus at gcc dot gnu dot
                   |                            |org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34143



More information about the Gcc-bugs mailing list