| 1 |
! { dg-do run } |
| 2 |
|
| 3 |
! PR fortran/35681 |
| 4 |
! Check that dependencies of MVBITS arguments are resolved correctly by using |
| 5 |
! temporaries if both arguments refer to the same variable. |
| 6 |
|
| 7 |
integer, dimension(10) :: ila1 = (/1,2,3,4,5,6,7,8,9,10/) |
| 8 |
integer, dimension(20) :: ila2 |
| 9 |
integer, dimension(10), target :: ila3 |
| 10 |
integer, pointer :: ila3_ptr(:) |
| 11 |
integer, parameter :: SHOULD_BE(10) = (/17,18,11,4,13,22,7,16,9,18/) |
| 12 |
integer, parameter :: INDEX_VECTOR(10) = (/9,9,6,2,4,9,2,9,6,10/) |
| 13 |
|
| 14 |
ila2(2:20:2) = ila1 |
| 15 |
ila3 = ila1 |
| 16 |
|
| 17 |
! Argument is already packed. |
| 18 |
call mvbits (ila1(INDEX_VECTOR), 2, 4, ila1, 3) |
| 19 |
write (*,'(10(I3))') ila1 |
| 20 |
if (any (ila1 /= SHOULD_BE)) STOP 1 |
| 21 |
|
| 22 |
! Argument is not packed. |
| 23 |
call mvbits (ila2(2*INDEX_VECTOR), 2, 4, ila2(2:20:2), 3) |
| 24 |
write (*,'(10(I3))') ila2(2:20:2) |
| 25 |
if (any (ila2(2:20:2) /= SHOULD_BE)) STOP 2 |
| 26 |
|
| 27 |
! Pointer and target |
| 28 |
ila3_ptr => ila3 |
| 29 |
call mvbits (ila3(INDEX_VECTOR), 2, 4, ila3_ptr, 3) |
| 30 |
write (*,'(10(I3))') ila3 |
| 31 |
if (any (ila3 /= SHOULD_BE)) STOP 3 |
| 32 |
|
| 33 |
end |