TR15581 - elemental assignment of structures with alloctable components

Paul Thomas paulthomas2@wanadoo.fr
Tue Jul 4 21:59:00 GMT 2006


In testing the patch that Erik and I are developing for allocatable 
components, I encountered a standards wrinkle that I do not see how to 
resolve:

The iso_varying_string testsuite now mostly works, except for vst_2.f95 
and three others that have IO problems.  vst_2.f95 fails on elemental 
assignment of arrays of structures with allocatable components.  My 
version of the patch (I have to see what Eriks's does tomorrow!) 
deallocates the destination, copies the structure and then deallocates 
the source.  Rereading the standard, I now see that the final stage is 
not correct.  However, this raise the question, "how do we copy the 
structure"?

(i) a shallow copy simply copies the structure and points to the same 
allocated data for allocatable components.
(ii) a deep copy copies the structure and the data pointed to by its 
allocatable components and continues the copy through to ultimate 
components.

My current opinion is that I was completely wrong and that (ii) is 
correct.  Can anybody help please?

Paul



More information about the Fortran mailing list