2 ! { dg-options "-fcheck=bits -fdump-tree-original" }
3 ! { dg-shouldfail "Fortran runtime error: FROMPOS(64)+LEN(1)>BIT_SIZE(64) in intrinsic MVBITS" }
4 ! { dg-output "At line 33 .*" }
6 ! Verify that the runtime checks for the MVBITS intrinsic functions
7 ! do not generate false-positives
10 integer, parameter :: bs4
= bit_size (1_4)
11 integer, parameter :: bs8
= bit_size (1_8)
12 integer(4), dimension(0:bs4
) :: from4
, frompos4
, len4
, to4
, topos4
13 integer(8), dimension(0:bs8
) :: from8
, frompos8
, len8
, to8
, topos8
17 len4
= [ (i
, i
=0,bs4
) ]
20 call mvbits (from4
, frompos4
, len4
, to4
, topos4
)
21 if (any (to4
/= -1)) stop 1
24 len8
= [ (i
, i
=0,bs8
) ]
27 call mvbits (from8
, frompos8
, len8
, to8
, topos8
)
28 if (any (to8
/= -1)) stop 2
32 ! The following line should fail with a runtime error:
33 call mvbits (from8
, frompos8
, len8
, to8
, topos8
)
34 ! Should never get here with -fcheck=bits
38 ! { dg-final { scan-tree-dump-times "_gfortran_runtime_error_at" 15 "original" } }