OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [tags/] [gnu-src/] [gcc-4.5.1/] [gcc-4.5.1-or32-1.0rc2/] [gcc/] [testsuite/] [gfortran.dg/] [subref_array_pointer_1.f90] - Diff between revs 302 and 384

Only display areas with differences | Details | Blame | View Log

Rev 302 Rev 384
! { dg-do run }
! { dg-do run }
! Test the fix for PRs29396, 29606, 30625 and 30871, in which pointers
! Test the fix for PRs29396, 29606, 30625 and 30871, in which pointers
! to arrays with subreferences did not work.
! to arrays with subreferences did not work.
!
!
  call pr29396
  call pr29396
  call pr29606
  call pr29606
  call pr30625
  call pr30625
  call pr30871
  call pr30871
contains
contains
  subroutine pr29396
  subroutine pr29396
! Contributed by Francois-Xavier Coudert 
! Contributed by Francois-Xavier Coudert 
    CHARACTER(LEN=2), DIMENSION(:), POINTER :: a
    CHARACTER(LEN=2), DIMENSION(:), POINTER :: a
    CHARACTER(LEN=4), DIMENSION(3), TARGET :: b
    CHARACTER(LEN=4), DIMENSION(3), TARGET :: b
    b=(/"bbbb","bbbb","bbbb"/)
    b=(/"bbbb","bbbb","bbbb"/)
    a=>b(:)(2:3)
    a=>b(:)(2:3)
    a="aa"
    a="aa"
    IF (ANY(b.NE.(/"baab","baab","baab"/))) CALL ABORT()
    IF (ANY(b.NE.(/"baab","baab","baab"/))) CALL ABORT()
  END subroutine
  END subroutine
  subroutine pr29606
  subroutine pr29606
! Contributed by Daniel Franke 
! Contributed by Daniel Franke 
    TYPE foo
    TYPE foo
      INTEGER :: value
      INTEGER :: value
    END TYPE
    END TYPE
    TYPE foo_array
    TYPE foo_array
      TYPE(foo), DIMENSION(:), POINTER :: array
      TYPE(foo), DIMENSION(:), POINTER :: array
    END TYPE
    END TYPE
    TYPE(foo_array)                :: array_holder
    TYPE(foo_array)                :: array_holder
    INTEGER, DIMENSION(:), POINTER :: array_ptr
    INTEGER, DIMENSION(:), POINTER :: array_ptr
    ALLOCATE( array_holder%array(3) )
    ALLOCATE( array_holder%array(3) )
    array_holder%array = (/ foo(1), foo(2), foo(3) /)
    array_holder%array = (/ foo(1), foo(2), foo(3) /)
    array_ptr => array_holder%array%value
    array_ptr => array_holder%array%value
    if (any (array_ptr .ne. (/1,2,3/))) call abort ()
    if (any (array_ptr .ne. (/1,2,3/))) call abort ()
  END subroutine
  END subroutine
  subroutine pr30625
  subroutine pr30625
! Contributed by Paul Thomas 
! Contributed by Paul Thomas 
    type :: a
    type :: a
      real :: r = 3.14159
      real :: r = 3.14159
      integer :: i = 42
      integer :: i = 42
    end type a
    end type a
    type(a), target :: dt(2)
    type(a), target :: dt(2)
    integer, pointer :: ip(:)
    integer, pointer :: ip(:)
    ip => dt%i
    ip => dt%i
    if (any (ip .ne. 42)) call abort ()
    if (any (ip .ne. 42)) call abort ()
  end subroutine
  end subroutine
  subroutine pr30871
  subroutine pr30871
! Contributed by Joost VandeVondele 
! Contributed by Joost VandeVondele 
    TYPE data
    TYPE data
      CHARACTER(LEN=3) :: A
      CHARACTER(LEN=3) :: A
    END TYPE
    END TYPE
    TYPE(data), DIMENSION(10), TARGET :: Z
    TYPE(data), DIMENSION(10), TARGET :: Z
    CHARACTER(LEN=1), DIMENSION(:), POINTER :: ptr
    CHARACTER(LEN=1), DIMENSION(:), POINTER :: ptr
    Z(:)%A="123"
    Z(:)%A="123"
    ptr=>Z(:)%A(2:2)
    ptr=>Z(:)%A(2:2)
    if (any (ptr .ne. "2")) call abort ()
    if (any (ptr .ne. "2")) call abort ()
  END subroutine
  END subroutine
end
end
 
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.