diff options
author | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
---|---|---|
committer | upstream source tree <ports@midipix.org> | 2015-03-15 20:14:05 -0400 |
commit | 554fd8c5195424bdbcabf5de30fdc183aba391bd (patch) | |
tree | 976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gfortran.dg/subref_array_pointer_1.f90 | |
download | cbb-gcc-4.6.4-upstream.tar.bz2 cbb-gcc-4.6.4-upstream.tar.xz |
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig;
imported gcc-4.6.4 source tree from verified upstream tarball.
downloading a git-generated archive based on the 'upstream' tag
should provide you with a source tree that is binary identical
to the one extracted from the above tarball.
if you have obtained the source via the command 'git clone',
however, do note that line-endings of files in your working
directory might differ from line-endings of the respective
files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/gfortran.dg/subref_array_pointer_1.f90')
-rw-r--r-- | gcc/testsuite/gfortran.dg/subref_array_pointer_1.f90 | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/subref_array_pointer_1.f90 b/gcc/testsuite/gfortran.dg/subref_array_pointer_1.f90 new file mode 100644 index 000000000..7bb0ff5e6 --- /dev/null +++ b/gcc/testsuite/gfortran.dg/subref_array_pointer_1.f90 @@ -0,0 +1,59 @@ +! { dg-do run } +! Test the fix for PRs29396, 29606, 30625 and 30871, in which pointers +! to arrays with subreferences did not work. +! + call pr29396 + call pr29606 + call pr30625 + call pr30871 +contains + subroutine pr29396 +! Contributed by Francois-Xavier Coudert <fxcoudert@gcc.gnu.org> + CHARACTER(LEN=2), DIMENSION(:), POINTER :: a + CHARACTER(LEN=4), DIMENSION(3), TARGET :: b + b=(/"bbbb","bbbb","bbbb"/) + a=>b(:)(2:3) + a="aa" + IF (ANY(b.NE.(/"baab","baab","baab"/))) CALL ABORT() + END subroutine + + subroutine pr29606 +! Contributed by Daniel Franke <franke.daniel@gmail.com> + TYPE foo + INTEGER :: value + END TYPE + TYPE foo_array + TYPE(foo), DIMENSION(:), POINTER :: array + END TYPE + TYPE(foo_array) :: array_holder + INTEGER, DIMENSION(:), POINTER :: array_ptr + ALLOCATE( array_holder%array(3) ) + array_holder%array = (/ foo(1), foo(2), foo(3) /) + array_ptr => array_holder%array%value + if (any (array_ptr .ne. (/1,2,3/))) call abort () + END subroutine + + subroutine pr30625 +! Contributed by Paul Thomas <pault@gcc.gnu.org> + type :: a + real :: r = 3.14159 + integer :: i = 42 + end type a + type(a), target :: dt(2) + integer, pointer :: ip(:) + ip => dt%i + if (any (ip .ne. 42)) call abort () + end subroutine + + subroutine pr30871 +! Contributed by Joost VandeVondele <jv244@cam.ac.uk> + TYPE data + CHARACTER(LEN=3) :: A + END TYPE + TYPE(data), DIMENSION(10), TARGET :: Z + CHARACTER(LEN=1), DIMENSION(:), POINTER :: ptr + Z(:)%A="123" + ptr=>Z(:)%A(2:2) + if (any (ptr .ne. "2")) call abort () + END subroutine +end |