| 1 |
! { dg-additional-options "-fno-inline" } |
| 2 |
|
| 3 |
#define N 200 |
| 4 |
|
| 5 |
#define TEST_VALUE(I) ((I) * 5 / 2) |
| 6 |
|
| 7 |
subroutine setup(a) |
| 8 |
real :: a(N) |
| 9 |
do i = 1, N |
| 10 |
a(i) = TEST_VALUE(i) |
| 11 |
end do |
| 12 |
end subroutine |
| 13 |
|
| 14 |
subroutine check(a, x, gap) |
| 15 |
real :: a(N), temp, x |
| 16 |
integer :: gap |
| 17 |
do i = 1, N - gap |
| 18 |
temp = a(i + gap) + x |
| 19 |
if (a(i) /= temp) STOP 1 |
| 20 |
end do |
| 21 |
do i = N - gap + 1, N |
| 22 |
temp = TEST_VALUE(i) |
| 23 |
if (a(i) /= temp) STOP 2 |
| 24 |
end do |
| 25 |
end subroutine |
| 26 |
|
| 27 |
subroutine testa(a, x, base, n) |
| 28 |
real :: a(n), x |
| 29 |
integer :: base, n |
| 30 |
do i = n, 2, -1 |
| 31 |
a(base + i - 1) = a(base + i) + x |
| 32 |
end do |
| 33 |
end subroutine testa |
| 34 |
|
| 35 |
subroutine testb(a, x, base, n) |
| 36 |
real :: a(n), x |
| 37 |
integer :: base |
| 38 |
do i = n, 4, -1 |
| 39 |
a(base + i - 3) = a(base + i) + x |
| 40 |
end do |
| 41 |
end subroutine testb |
| 42 |
|
| 43 |
subroutine testc(a, x, base, n) |
| 44 |
real :: a(n), x |
| 45 |
integer :: base |
| 46 |
do i = n, 8, -1 |
| 47 |
a(base + i - 7) = a(base + i) + x |
| 48 |
end do |
| 49 |
end subroutine testc |
| 50 |
|
| 51 |
subroutine testd(a, x, base, n) |
| 52 |
real :: a(n), x |
| 53 |
integer :: base |
| 54 |
do i = n, 16, -1 |
| 55 |
a(base + i - 15) = a(base + i) + x |
| 56 |
end do |
| 57 |
end subroutine testd |
| 58 |
|
| 59 |
subroutine teste(a, x, base, n) |
| 60 |
real :: a(n), x |
| 61 |
integer :: base |
| 62 |
do i = n, 32, -1 |
| 63 |
a(base + i - 31) = a(base + i) + x |
| 64 |
end do |
| 65 |
end subroutine teste |
| 66 |
|
| 67 |
subroutine testf(a, x, base, n) |
| 68 |
real :: a(n), x |
| 69 |
integer :: base |
| 70 |
do i = n, 64, -1 |
| 71 |
a(base + i - 63) = a(base + i) + x |
| 72 |
end do |
| 73 |
end subroutine testf |
| 74 |
|
| 75 |
program main |
| 76 |
real :: a(N) |
| 77 |
|
| 78 |
call setup(a) |
| 79 |
call testa(a, 91.0, 0, N) |
| 80 |
call check(a, 91.0, 1) |
| 81 |
|
| 82 |
call setup(a) |
| 83 |
call testb(a, 55.0, 0, N) |
| 84 |
call check(a, 55.0, 3) |
| 85 |
|
| 86 |
call setup(a) |
| 87 |
call testc(a, 72.0, 0, N) |
| 88 |
call check(a, 72.0, 7) |
| 89 |
|
| 90 |
call setup(a) |
| 91 |
call testd(a, 69.0, 0, N) |
| 92 |
call check(a, 69.0, 15) |
| 93 |
|
| 94 |
call setup(a) |
| 95 |
call teste(a, 44.0, 0, N) |
| 96 |
call check(a, 44.0, 31) |
| 97 |
|
| 98 |
call setup(a) |
| 99 |
call testf(a, 39.0, 0, N) |
| 100 |
call check(a, 39.0, 63) |
| 101 |
end program |