$ uname -a
Linux localhost.localdomain 2.6.29.4-167.fc11.i686.PAE #1 SMP Wed May 27
17:28:22 EDT 2009 i686 i686 i386 GNU/Linux
$ /usr/local/gfortran/bin/gfortran --version
GNU Fortran (GCC) 4.5.0 20091205 (experimental) [trunk revision 155016]
$ cat x.f95
PROGRAM X
TYPE T
   INTEGER :: I
END TYPE T
TYPE(T), TARGET :: T1(3)
INTEGER, POINTER :: P(:)

T1(1)%I = 1
T1(2)%I = 2
T1(3)%I = 3
P => T1%I
CALL Z(P)
PRINT *, T1%I

CONTAINS

SUBROUTINE Z(Q)
INTEGER, POINTER :: Q(:)
Q(1) = 999
END SUBROUTINE Z

END PROGRAM X

$ /usr/local/gfortran/bin/gfortran -o x x.f95
$ ./x
           1         999           3

!! The output is wrong.
I am expecting this output:
         999           2           3


-- 
           Summary: Problem with a pointer array passed to a subroutine
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: gilbert dot scott at easynet dot co dot uk
  GCC host triplet: 4.5.0


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42309

Reply via email to