1! REPEAT intrinsic 2! 3! { dg-do run } 4subroutine foo(i, j, s, t) 5 implicit none 6 integer, intent(in) :: i, j 7 character(len=i), intent(in) :: s 8 character(len=i*j), intent(in) :: t 9 10 if (repeat(s,j) /= t) STOP 1 11 call bar(j,s,t) 12end subroutine foo 13 14subroutine bar(j, s, t) 15 implicit none 16 integer, intent(in) :: j 17 character(len=*), intent(in) :: s 18 character(len=len(s)*j), intent(in) :: t 19 20 if (repeat(s,j) /= t) STOP 2 21end subroutine bar 22 23program test 24 implicit none 25 character(len=0), parameter :: s0 = "" 26 character(len=1), parameter :: s1 = "a" 27 character(len=2), parameter :: s2 = "ab" 28 character(len=0) :: t0 29 character(len=1) :: t1 30 character(len=2) :: t2 31 integer :: i 32 33 t0 = "" 34 t1 = "a" 35 t2 = "ab" 36 37 if (repeat(t0, 0) /= "") STOP 3 38 if (repeat(t1, 0) /= "") STOP 4 39 if (repeat(t2, 0) /= "") STOP 5 40 if (repeat(t0, 1) /= "") STOP 6 41 if (repeat(t1, 1) /= "a") STOP 7 42 if (repeat(t2, 1) /= "ab") STOP 8 43 if (repeat(t0, 2) /= "") STOP 9 44 if (repeat(t1, 2) /= "aa") STOP 10 45 if (repeat(t2, 2) /= "abab") STOP 11 46 47 if (repeat(s0, 0) /= "") STOP 12 48 if (repeat(s1, 0) /= "") STOP 13 49 if (repeat(s2, 0) /= "") STOP 14 50 if (repeat(s0, 1) /= "") STOP 15 51 if (repeat(s1, 1) /= "a") STOP 16 52 if (repeat(s2, 1) /= "ab") STOP 17 53 if (repeat(s0, 2) /= "") STOP 18 54 if (repeat(s1, 2) /= "aa") STOP 19 55 if (repeat(s2, 2) /= "abab") STOP 20 56 57 i = 0 58 if (repeat(t0, i) /= "") STOP 21 59 if (repeat(t1, i) /= "") STOP 22 60 if (repeat(t2, i) /= "") STOP 23 61 i = 1 62 if (repeat(t0, i) /= "") STOP 24 63 if (repeat(t1, i) /= "a") STOP 25 64 if (repeat(t2, i) /= "ab") STOP 26 65 i = 2 66 if (repeat(t0, i) /= "") STOP 27 67 if (repeat(t1, i) /= "aa") STOP 28 68 if (repeat(t2, i) /= "abab") STOP 29 69 70 i = 0 71 if (repeat(s0, i) /= "") STOP 30 72 if (repeat(s1, i) /= "") STOP 31 73 if (repeat(s2, i) /= "") STOP 32 74 i = 1 75 if (repeat(s0, i) /= "") STOP 33 76 if (repeat(s1, i) /= "a") STOP 34 77 if (repeat(s2, i) /= "ab") STOP 35 78 i = 2 79 if (repeat(s0, i) /= "") STOP 36 80 if (repeat(s1, i) /= "aa") STOP 37 81 if (repeat(s2, i) /= "abab") STOP 38 82 83 call foo(0,0,"","") 84 call foo(0,1,"","") 85 call foo(0,2,"","") 86 call foo(1,0,"a","") 87 call foo(1,1,"a","a") 88 call foo(1,2,"a","aa") 89 call foo(2,0,"ab","") 90 call foo(2,1,"ab","ab") 91 call foo(2,2,"ab","abab") 92end program test 93