1! { dg-do run }
2!
3! PR fortran/33197
4!
5! Check implementation of PARITY
6!
7implicit none
8
9integer :: i
10logical :: Lt(1) = [ .true. ]
11logical :: Lf(1) = [ .false.]
12logical :: Ltf(2) = [ .true., .false. ]
13logical :: Ltftf(4) = [.true., .false., .true.,.false.]
14
15if (parity([logical ::]) .neqv. .false.) call abort()
16if (parity([.true., .false.]) .neqv. .true.) call abort()
17if (parity([.true.]) .neqv. .true.) call abort()
18if (parity([.false.]) .neqv. .false.) call abort()
19if (parity([.true., .false., .true.,.false.]) .neqv. .false.) call abort()
20if (parity(reshape([.true., .false., .true.,.false.],[2,2])) &
21    .neqv. .false.) call abort()
22if (any (parity(reshape([.true., .false., .true.,.false.],[2,2]),dim=1) &
23         .neqv. [.true., .true.])) call abort()
24if (any (parity(reshape([.true., .false., .true.,.false.],[2,2]),dim=2) &
25         .neqv. [.false., .false.])) call abort()
26
27i = 0
28if (parity(Lt(1:i)) .neqv. .false.) call abort()
29if (parity(Ltf) .neqv. .true.) call abort()
30if (parity(Lt) .neqv. .true.) call abort()
31if (parity(Lf) .neqv. .false.) call abort()
32if (parity(Ltftf) .neqv. .false.) call abort()
33if (parity(reshape(Ltftf,[2,2])) &
34    .neqv. .false.) call abort()
35if (any (parity(reshape(Ltftf,[2,2]),dim=1) &
36         .neqv. [.true., .true.])) call abort()
37if (any (parity(reshape(Ltftf,[2,2]),dim=2) &
38         .neqv. [.false., .false.])) call abort()
39
40end
41