File: dec_logical_xor_1.f90

package info (click to toggle)
gcc-arm-none-eabi 15%3A14.2.rel1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,099,328 kB
  • sloc: cpp: 3,627,108; ansic: 2,571,498; ada: 834,230; f90: 235,082; makefile: 79,231; asm: 74,984; xml: 51,692; exp: 39,736; sh: 33,298; objc: 15,629; python: 15,069; fortran: 14,429; pascal: 7,003; awk: 5,070; perl: 3,106; ml: 285; lisp: 253; lex: 204; haskell: 135
file content (40 lines) | stat: -rw-r--r-- 804 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
! { dg-do run }
! { dg-options "-std=legacy" }
!
! Test logical .XOR. operator.
!

implicit none

logical :: in1, in2, neqv_out, lxor_out, truth_table(2)
integer :: i, j, ixor_out, ieor_out

truth_table(1) = .true.
truth_table(2) = .false.
do i = 1,2
  do j = 1,2
    in1 = truth_table(j)
    in2 = truth_table(i)

    ! make sure logical xor works
    neqv_out = in1 .neqv. in2
    lxor_out = in1 .xor. in2

    if ( neqv_out .neqv. lxor_out ) then
      print *, "(",in1,in2,") .neqv.: ",neqv_out,"  .xor.: ",lxor_out
      STOP 1
    endif

    ! make sure we didn't break xor() intrinsic
    ixor_out = xor(i*7, j*5)
    ieor_out = ieor(i*7, j*5)

    if ( ixor_out .ne. ieor_out ) then
      print *, "(",in1,in2,") ieor(): ",ieor_out,"  xor(): ",ixor_out
      STOP 2
    endif

  enddo
enddo

end