2 ! { dg-options "-fcheck=bits -fdump-tree-original" }
3 ! { dg-shouldfail "Fortran runtime error: SIZE argument (0) out of range 1:32 in intrinsic ISHFTC" }
4 ! { dg-output "At line 44 .*" }
6 ! Verify that the runtime checks for the bit manipulation intrinsic functions
7 ! do not generate false-positives
10 integer :: i
, k
, pos
, len
, shift
, size
, nb
16 if (btest (i
, pos
)) stop 1
20 i
= ibits (i
, pos
, len
)
28 k
= shiftl (i
, shift
) ! Fortran 2008
31 k
= lshift (i
, shift
) ! GNU extensions
36 i
= ishftc (k
, -shift
)
37 do size
= max (1,shift
), nb
38 k
= ishftc (i
, shift
, size
)
39 i
= ishftc (k
, -shift
, size
)
43 ! The following line should fail with a runtime error:
44 k
= ishftc (i
, 0, size
)
45 ! Should never get here with -fcheck=bits
49 ! { dg-final { scan-tree-dump-times "_gfortran_runtime_error_at" 21 "original" } }