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/repeat_2.f90 | |
download | cbb-gcc-4.6.4-15d2061ac0796199866debe9ac87130894b0cdd3.tar.bz2 cbb-gcc-4.6.4-15d2061ac0796199866debe9ac87130894b0cdd3.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/repeat_2.f90')
-rw-r--r-- | gcc/testsuite/gfortran.dg/repeat_2.f90 | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/repeat_2.f90 b/gcc/testsuite/gfortran.dg/repeat_2.f90 new file mode 100644 index 000000000..d71f1860a --- /dev/null +++ b/gcc/testsuite/gfortran.dg/repeat_2.f90 @@ -0,0 +1,92 @@ +! REPEAT intrinsic +! +! { dg-do run } +subroutine foo(i, j, s, t) + implicit none + integer, intent(in) :: i, j + character(len=i), intent(in) :: s + character(len=i*j), intent(in) :: t + + if (repeat(s,j) /= t) call abort + call bar(j,s,t) +end subroutine foo + +subroutine bar(j, s, t) + implicit none + integer, intent(in) :: j + character(len=*), intent(in) :: s + character(len=len(s)*j), intent(in) :: t + + if (repeat(s,j) /= t) call abort +end subroutine bar + +program test + implicit none + character(len=0), parameter :: s0 = "" + character(len=1), parameter :: s1 = "a" + character(len=2), parameter :: s2 = "ab" + character(len=0) :: t0 + character(len=1) :: t1 + character(len=2) :: t2 + integer :: i + + t0 = "" + t1 = "a" + t2 = "ab" + + if (repeat(t0, 0) /= "") call abort + if (repeat(t1, 0) /= "") call abort + if (repeat(t2, 0) /= "") call abort + if (repeat(t0, 1) /= "") call abort + if (repeat(t1, 1) /= "a") call abort + if (repeat(t2, 1) /= "ab") call abort + if (repeat(t0, 2) /= "") call abort + if (repeat(t1, 2) /= "aa") call abort + if (repeat(t2, 2) /= "abab") call abort + + if (repeat(s0, 0) /= "") call abort + if (repeat(s1, 0) /= "") call abort + if (repeat(s2, 0) /= "") call abort + if (repeat(s0, 1) /= "") call abort + if (repeat(s1, 1) /= "a") call abort + if (repeat(s2, 1) /= "ab") call abort + if (repeat(s0, 2) /= "") call abort + if (repeat(s1, 2) /= "aa") call abort + if (repeat(s2, 2) /= "abab") call abort + + i = 0 + if (repeat(t0, i) /= "") call abort + if (repeat(t1, i) /= "") call abort + if (repeat(t2, i) /= "") call abort + i = 1 + if (repeat(t0, i) /= "") call abort + if (repeat(t1, i) /= "a") call abort + if (repeat(t2, i) /= "ab") call abort + i = 2 + if (repeat(t0, i) /= "") call abort + if (repeat(t1, i) /= "aa") call abort + if (repeat(t2, i) /= "abab") call abort + + i = 0 + if (repeat(s0, i) /= "") call abort + if (repeat(s1, i) /= "") call abort + if (repeat(s2, i) /= "") call abort + i = 1 + if (repeat(s0, i) /= "") call abort + if (repeat(s1, i) /= "a") call abort + if (repeat(s2, i) /= "ab") call abort + i = 2 + if (repeat(s0, i) /= "") call abort + if (repeat(s1, i) /= "aa") call abort + if (repeat(s2, i) /= "abab") call abort + + call foo(0,0,"","") + call foo(0,1,"","") + call foo(0,2,"","") + call foo(1,0,"a","") + call foo(1,1,"a","a") + call foo(1,2,"a","aa") + call foo(2,0,"ab","") + call foo(2,1,"ab","ab") + call foo(2,2,"ab","abab") +end program test |