This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: TR15581 - elemental assignment of structures with alloctable components
- From: Richard E Maine <Richard dot Maine at nasa dot gov>
- To: Brooks Moses <bmoses at stanford dot edu>
- Cc: fortran at gcc dot gnu dot org
- Date: Wed, 5 Jul 2006 10:09:17 -0700
- Subject: Re: TR15581 - elemental assignment of structures with alloctable components
- References: <44AAE485.8010008@wanadoo.fr> <44ABEE98.7060001@stanford.edu>
On Jul 5, 2006, at 9:53 AM, Brooks Moses wrote:
Paul Thomas wrote:
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....
I think this falls under a category of situations that Richard
Maine was talking about on comp.lang.fortran recently --
specifically, that the standard expects that allocatable arrays
will work exactly as non-allocatable arrays do, except in places
where they are explicitly different. (Specifically, they are not
assumed to act like pointers!)...
(i) A copy of the structure is made, and any allocatable components
are storage-associated with the corresponding allocatable
components of the original, whereas the non-allocatable components
are not storage-associated.
(ii) A copy of the structure is made, and none of the components of
the copy are storage-associated with the components of the original.
My opinion is that, when it's looked at that way, the first option
is pretty clearly wrong. Unless one makes assumptions about
implementation (which is contrary to the spirit of the Fortran
standards), the part about allocatable components being storage-
associated on copy just comes out of left field, and makes no sense.
For what it is worth, I agree with Brooks, and I also think that was
a good job of explanation. I could dig up the citations, but it
doesn't really seem necessary, as choice 1 is so "obviously" wrong
that if the standard actually said that I'd be inclined to submit a
"bug report" (aka interpretation request) on the standard.
--
Richard Maine | Good judgment comes from experience;
Richard.Maine@nasa.gov | experience comes from bad judgment.
| -- Mark Twain