summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/mvbits_4.f90
diff options
context:
space:
mode:
authorbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2008-11-03 20:17:38 +0000
committerbstarynk <bstarynk@138bc75d-0d04-0410-961f-82ee72b054a4>2008-11-03 20:17:38 +0000
commit2b2b3bd8d96c3193c8d9bc606ee1b5b3c9b47000 (patch)
tree81e969bd3646dc338eed81f44730a7c467aebe3b /gcc/testsuite/gfortran.dg/mvbits_4.f90
parentd4f000ef87b18faf42726f23e17b15a8f14fe618 (diff)
downloadgcc-2b2b3bd8d96c3193c8d9bc606ee1b5b3c9b47000.tar.gz
2008-11-03 Basile Starynkevitch <basile@starynkevitch.net>
MELT branch merged with trunk r141555 git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/melt-branch@141561 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gfortran.dg/mvbits_4.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/mvbits_4.f9033
1 files changed, 33 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/mvbits_4.f90 b/gcc/testsuite/gfortran.dg/mvbits_4.f90
new file mode 100644
index 00000000000..b8d32140c78
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/mvbits_4.f90
@@ -0,0 +1,33 @@
+! { dg-do run }
+
+! PR fortran/35681
+! Check that dependencies of MVBITS arguments are resolved correctly by using
+! temporaries if both arguments refer to the same variable.
+
+ integer, dimension(10) :: ila1 = (/1,2,3,4,5,6,7,8,9,10/)
+ integer, dimension(20) :: ila2
+ integer, dimension(10), target :: ila3
+ integer, pointer :: ila3_ptr(:)
+ integer, parameter :: SHOULD_BE(10) = (/17,18,11,4,13,22,7,16,9,18/)
+ integer, parameter :: INDEX_VECTOR(10) = (/9,9,6,2,4,9,2,9,6,10/)
+
+ ila2(2:20:2) = ila1
+ ila3 = ila1
+
+ ! Argument is already packed.
+ call mvbits (ila1(INDEX_VECTOR), 2, 4, ila1, 3)
+ write (*,'(10(I3))') ila1
+ if (any (ila1 /= SHOULD_BE)) call abort ()
+
+ ! Argument is not packed.
+ call mvbits (ila2(2*INDEX_VECTOR), 2, 4, ila2(2:20:2), 3)
+ write (*,'(10(I3))') ila2(2:20:2)
+ if (any (ila2(2:20:2) /= SHOULD_BE)) call abort ()
+
+ ! Pointer and target
+ ila3_ptr => ila3
+ call mvbits (ila3(INDEX_VECTOR), 2, 4, ila3_ptr, 3)
+ write (*,'(10(I3))') ila3
+ if (any (ila3 /= SHOULD_BE)) call abort ()
+
+ end