From 554fd8c5195424bdbcabf5de30fdc183aba391bd Mon Sep 17 00:00:00 2001 From: upstream source tree Date: Sun, 15 Mar 2015 20:14:05 -0400 Subject: obtained gcc-4.6.4.tar.bz2 from upstream website; 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. --- gcc/testsuite/gfortran.dg/contiguous_3.f90 | 65 ++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 gcc/testsuite/gfortran.dg/contiguous_3.f90 (limited to 'gcc/testsuite/gfortran.dg/contiguous_3.f90') diff --git a/gcc/testsuite/gfortran.dg/contiguous_3.f90 b/gcc/testsuite/gfortran.dg/contiguous_3.f90 new file mode 100644 index 000000000..aac55367a --- /dev/null +++ b/gcc/testsuite/gfortran.dg/contiguous_3.f90 @@ -0,0 +1,65 @@ +! { dg-do compile } +! { dg-options "-fdump-tree-original" } +! +! PR fortran/40632 +! +! CONTIGUOUS compile-time tests: Check that contigous +! works properly. + +subroutine test1(a,b) + integer, pointer, contiguous :: test1_a(:) + call foo(test1_a) + call foo(test1_a(::1)) + call foo(test1_a(::2)) +contains + subroutine foo(b) + integer :: b(*) + end subroutine foo +end subroutine test1 + +! For the first two no pack is done; for the third one, an array descriptor +! (cf. below test3) is created for packing. +! +! { dg-final { scan-tree-dump-times "_internal_pack.*test1_a" 0 "original" } } +! { dg-final { scan-tree-dump-times "_internal_unpack.*test1_a" 0 "original" } } + + +subroutine t2(a1,b1,c2,d2) + integer, pointer, contiguous :: a1(:), b1(:) + integer, pointer :: c2(:), d2(:) + a1 = b1 + c2 = d2 +end subroutine t2 + +! { dg-final { scan-tree-dump-times "= a1->dim.0..stride;" 0 "original" } } +! { dg-final { scan-tree-dump-times "= b1->dim.0..stride;" 0 "original" } } +! { dg-final { scan-tree-dump-times "= c2->dim.0..stride;" 1 "original" } } +! { dg-final { scan-tree-dump-times "= d2->dim.0..stride;" 1 "original" } } + + +subroutine test3() + implicit none + integer :: test3_a(8),i + test3_a = [(i,i=1,8)] + call foo(test3_a(::1)) + call foo(test3_a(::2)) + call bar(test3_a(::1)) + call bar(test3_a(::2)) +contains + subroutine foo(x) + integer, contiguous :: x(:) + print *, x + end subroutine + subroutine bar(x) + integer :: x(:) + print *, x + end subroutine bar +end subroutine test3 + +! Once for test1 (third call), once for test3 (second call) +! { dg-final { scan-tree-dump-times "data = origptr" 1 "original" } } +! { dg-final { scan-tree-dump-times "_gfortran_internal_pack .&parm" 2 "original" } } +! { dg-final { scan-tree-dump-times "_gfortran_internal_unpack .&parm" 2 "original" } } + + +! { dg-final { cleanup-tree-dump "original" } } -- cgit v1.2.3