| 1 |
! { dg-do run } |
| 2 |
! { dg-options "-std=legacy" } |
| 3 |
! |
| 4 |
! Test logical .XOR. operator. |
| 5 |
! |
| 6 |
|
| 7 |
implicit none |
| 8 |
|
| 9 |
logical :: in1, in2, neqv_out, lxor_out, truth_table(2) |
| 10 |
integer :: i, j, ixor_out, ieor_out |
| 11 |
|
| 12 |
truth_table(1) = .true. |
| 13 |
truth_table(2) = .false. |
| 14 |
do i = 1,2 |
| 15 |
do j = 1,2 |
| 16 |
in1 = truth_table(j) |
| 17 |
in2 = truth_table(i) |
| 18 |
|
| 19 |
! make sure logical xor works |
| 20 |
neqv_out = in1 .neqv. in2 |
| 21 |
lxor_out = in1 .xor. in2 |
| 22 |
|
| 23 |
if ( neqv_out .neqv. lxor_out ) then |
| 24 |
print *, "(",in1,in2,") .neqv.: ",neqv_out," .xor.: ",lxor_out |
| 25 |
STOP 1 |
| 26 |
endif |
| 27 |
|
| 28 |
! make sure we didn't break xor() intrinsic |
| 29 |
ixor_out = xor(i*7, j*5) |
| 30 |
ieor_out = ieor(i*7, j*5) |
| 31 |
|
| 32 |
if ( ixor_out .ne. ieor_out ) then |
| 33 |
print *, "(",in1,in2,") ieor(): ",ieor_out," xor(): ",ixor_out |
| 34 |
STOP 2 |
| 35 |
endif |
| 36 |
|
| 37 |
enddo |
| 38 |
enddo |
| 39 |
|
| 40 |
end |