This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: RFA: Revamp fortran array types
On Wed, Aug 19, 2009 at 06:43:13PM +0200, Toon Moene wrote:
> Tobias Burnus wrote:
>
> >On 08/19/2009 03:01 PM, Michael Matz wrote:
>
> >>On Wed, 19 Aug 2009, Toon Moene wrote:
>
> >>>Two names must not refer to the same or overlapping storage unless you,
> >>>the programmer, indicate that they do (by either using EQUIVALENCE or
> >>>designating the storage with the TARGET attribute).
>
> >I agree about TARGET, but I do not fully agree about EQUIVALENCE.
> >Equivalenced variables share the same memory location, but only under
> >certain restrictions on may make use of it. (Though the expectations of
> >the users is probably more than what the standard guarantees.)
>
> Ah, sorry. The alias rules I tried to condense into a single sentence
> are about what you, the programmer can/not do *in case of writes*.
>
> The following code is perfectly OK:
>
> DIMENSION A(10)
> A = 10.0
> CALL SUB(A,A)
> END
> SUBROUTINE SUB(A,B)
> REAL, INTENT(IN) :: A(:), B(:)
What happens if you replace the last line with
REAL, INTENT(IN) :: A(:)
REAL, INTENT(OUT) :: B(:)
--
Steve