[Patch, Fortran] PR 42647: Missed initialization/dealloc of allocatable scalar DT with allocatable component

Salvatore Filippone salvatore.filippone@uniroma2.it
Thu Oct 14 08:30:00 GMT 2010


Tobias Burnus wrote:
>Possibly related: The test case in comment 10 of PR42647. There are two
>failures:
>
>a) allocate(a1, a1%b1, a1%b1%c1)
>causes a segfault - it works if one distributes it to three separate
>ALLOCATE statements. I have no idea whether this is valid code or not.
>-- It also applies to array allocatables and fails with NAG, PathScale
>and gfortran while it works with Intel and g95.

"The Fortran 2003 Handbook" at section 6.7.1 states, on restriction 12: 
"An allocate object or bound or type parameter must not depend on [....]
or on the value, bounds, length type parameters, allocation status, or
association status of any allocatable object in the same ALLOCATE
statement".

Thus the code is invalid. Metcalf,Cohen and Reid state that the idea is
for the compiler to be allowed to execute the allocations in any order.

Should this be recognized as a standard violation? I can imagine the
above to be relatively easy, while the general case might be arbitrarily
complicated.


Cheers
Salvatore 



More information about the Gcc-patches mailing list