Subject: hpff-interpret: NEW allocatables

From: Rob Schreiber <[email-masked]>
Date: Wed, 16 Oct 1996 17:05:03 -0700

---------------------------------------------------------------------------
[email-masked] is a mailing list for corrections,
clarifications, and interpretations related to High Performance Fortran.
Instructions for adding or deleting yourself from this list appear at the
bottom of this message.
---------------------------------------------------------------------------

Legal HPF?

    program prog1
    !!! NEW, allocatable, size the same at every iteration:

    real, allocatable :: a(:)

    allocate (a(<non-constant expression>))

    !hpf$ independent, new(a)
    do i = 1, 100
        a = i
        ...
    enddo

    print *, size(a)

    program prog2
    !!! NEW, allocatable, size the same at every iteration:

    real, allocatable :: a(:)

    !hpf$ independent, new(a)
    do i = 1, 100
        allocate (a(funct(i)))
        a = i
        ...
        deallocate(a)   ! ??? Is this required?
    enddo

Now, how about:

    program prog3
    !!! NEW, pointer, size the same at every iteration:

    real, pointer :: a(:)
    allocate (a(<non-constant expression>))
    !hpf$ independent, new(a)
    do i = 1, 100
        a = i
        ...
    enddo
    print *, size(a)

    program prog4
    !!! NEW, pointer, size the same at every iteration:

    real, pointer :: a(:)
    !hpf$ independent, new(a)
    do i = 1, 100
        allocate (a(funct(i)))
        a = i
        ...
        deallocate(a)   ! ??? Is this required?
    enddo

    program prog5
    !!! NEW, pointer, associated on entry

    real a, b
    pointer a; target b
    a => b
    !hpf$ independent, new(a,b)
    do i = 1, 100
        a = i
        ! Must a appear in the NEW clause?
        ! Must b appear in the NEW clause?
        ! Must both a and b appear in the NEW clause?
        ...
    enddo
    ! what is the status of a here?
    if (associated(a)) print *, 'A is associated'

    program prog6
    !!! NEW, pointer, associated on entry

    real a, b(100)
    pointer a; target b
    a => b(1)
    print *, a
    !hpf$ independent, new(a)
    do i = 1, 100
        a => b(i)
        a = i
        ...
    enddo
    ! what is the status of a here?
    if (associated(a)) print *, 'A is associated'

---------------------------------------------------------------------------
To (un)subscribe to this list, send mail to
[email-masked].
Leave the subject line blank, and in the body put the line
(un)subscribe <email-address>
---------------------------------------------------------------------------