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

--- Comment #6 from Rich Townsend <townsend at astro dot wisc.edu> 2011-06-19 
18:57:40 UTC ---
(In reply to comment #5)
> > In the first assignment b.U is allocated, in the second assignment it is not
> > freed, before being allocated again.
> 
> I don't think it should be freed then allocated for the second assignment in
> the code in comment#4.

Certainly, given that the lhs array component is the same shape as the rhs
array component, an optimization would be not to free and then allocate the
array prior to the copy.

However, that doesn't alter the fact that the behavior should be *as if* the
lhs array component were freed and then allocated with the appropriate shape.
This behavior has been in Fortran since TR 15581, which first introduced 
allocatable derived-type components as an extension to Fortran 95.

Reply via email to