From Waclaw.Marcin.Kusnierczyk at idi.ntnu.no  Tue Mar 24 16:15:22 2009
From: Waclaw.Marcin.Kusnierczyk at idi.ntnu.no (Wacek Kusnierczyk)
Date: Tue, 24 Mar 2009 16:15:22 +0100
Subject: [Rd] [R] variance/mean
In-Reply-To: <77EB52C6DD32BA4D87471DCD70C8D700E8F4A1@NA-PA-VBE03.na.tibco.com>
References: <20090322041729.6LTZR.3025252.root@mp11><49C601BD.3080506@idi.ntnu.no><001201c9abd1$4e04c5e0$3a0b2c0a@gne.windows.gene.com>
	<49C81DCE.1030901@idi.ntnu.no>
	<77EB52C6DD32BA4D87471DCD70C8D700E8F4A1@NA-PA-VBE03.na.tibco.com>
Message-ID: <49C8F90A.2030809@idi.ntnu.no>

William Dunlap wrote:
> Doesn't Fortran still require that the arguments to
> a function not alias each other (in whole or in part)?
>   

what do you mean?  the following works pretty fine:

    echo '
        program foo
        implicit none

        integer, target :: a = 1
        integer, pointer :: p1, p2, p3
        integer :: gee

        p1 => a
        p2 => a
        p3 => a
        write(*,*) p1, p2, p3
        call bar (p1, p2, p3)
        write(*,*) p1, p2, p3
        a = gee(p1, p2, p3)
        write(*,*) p1, p2, p3
      
        end program foo

        subroutine bar (p1, p2, p3)
        integer :: p1, p2, p3
        p3 = p1 + p2
        end subroutine bar

        function gee(p1, p2, p3)
        integer :: p1, p2, p3, gee
        p3 = p1 + p2
        gee = p3
        return
        end function gee

    ' > foo.f95

    gfortran foo.f95 -o foo
    ./foo
    # 1 1 1
    # 2 2 2
    # 4 4 4

clearly, p1, p2, and p3 are aliases of each other, and there is an
assignment made in both the subroutine and the function.  have i
misunderstood what you said?

vQ



[Rd] [R] variance/mean
Wacek Kusnierczyk