2 ! { dg-additional-options "-fcheck=bits" }
3 ! PR fortran/108937 - Intrinsic IBITS(I,POS,LEN) fails when LEN equals
5 ! Contributed by saitofuyuki@jamstec.go.jp
9 integer, parameter :: KT
= kind (1)
10 integer, parameter :: lbits
= bit_size (0_KT
)
11 integer(kind
=KT
) :: x
, y0
, y1
12 integer(kind
=KT
) :: p
, l
25 elemental
integer(kind
=KT
) function ibits_1(I
, POS
, LEN
) result(n
)
26 !! IBITS(I, POS, LEN) = (I >> POS) & ~((~0) << LEN)
28 integer(kind
=KT
),intent(in
) :: I
29 integer, intent(in
) :: POS
, LEN
30 n
= IAND (ISHFT(I
, - POS
), NOT(ISHFT(-1_KT
, LEN
)))