2 ! { dg-options "-ffrontend-optimize -fdump-tree-original" }
3 ! PR 57071 - Check that (-1)**k is transformed into 1-2*iand(k,1).
6 integer, parameter :: n
= 3
7 integer(kind
=8), dimension(-n
:n
) :: a
, b
8 integer, dimension(-n
:n
) :: c
, d
, e
11 integer (kind
=2) :: i2
15 ! Test in scalar expressions
17 if (v
**i
/= (-1)**i
) call abort
20 ! Test in array constructors
21 a(-m
:m
) = [ ((-1)**i
, i
= -m
, m
) ]
22 b(-m
:m
) = [ ( v
**i
, i
= -m
, m
) ]
23 if (any(a
.ne
. b
)) call abort
25 ! Test in array expressions
26 c
= [ ( i
, i
= -n
, n
) ]
29 if (any(d
.ne
. e
)) call abort
31 ! Test in different kind expressions
33 if (v
**i2
/= (-1)**i2
) call abort
37 ! { dg-final { scan-tree-dump-times "_gfortran_pow_i4_i4" 4 "original" } }