1 ! RUN: %python %S/test_errors.py %s %flang_fc1
2 ! Check for semantic errors in ishftc() function calls
5 use iso_fortran_env
, only
: int8
, int16
, int32
, int64
9 integer, allocatable
:: array_result(:)
10 integer, parameter :: const_arr1(2) = [-3,3]
11 integer, parameter :: const_arr2(2) = [3,0]
12 integer(kind
=8), parameter :: const_arr3(2) = [0,4]
13 integer(kind
=int8
), parameter :: const_arr4(2) = [0,4]
14 integer(kind
=int16
), parameter :: const_arr5(2) = [0,4]
15 integer(kind
=int32
), parameter :: const_arr6(2) = [0,4]
16 integer(kind
=int64
), parameter :: const_arr7(2) = [0,4]
19 array_result
= ishftc([3,3], [2,2], [3,3])
21 !ERROR: SIZE=-3 count for ishftc is not positive
23 !ERROR: SIZE=0 count for ishftc is not positive
25 !ERROR: SHIFT=2 count for ishftc is greater in magnitude than SIZE=1
27 !ERROR: SHIFT=-2 count for ishftc is greater in magnitude than SIZE=1
29 !ERROR: SHIFT=4 count for ishftc is greater in magnitude than SIZE=3
30 array_result
= ishftc(666, [(j
,integer::j
=1,5)], 3)
31 !ERROR: SHIFT=4 count for ishftc is greater in magnitude than SIZE=3
32 array_result
= ishftc(666, 4, [(j
,integer::j
=10,3,-1)])
33 !ERROR: SIZE=-3 count for ishftc is not positive
34 array_result
= ishftc([3,3], [2,2], [-3,3])
35 !ERROR: SIZE=-3 count for ishftc is not positive
36 array_result
= ishftc([3,3], [2,2], [-3,-3])
37 !ERROR: SIZE=-3 count for ishftc is not positive
38 array_result
= ishftc([3,3], [-2,-2], const_arr1
)
39 !ERROR: SIZE=0 count for ishftc is not positive
40 array_result
= ishftc([3,3], [-2,-2], const_arr2
)
41 !ERROR: SIZE=0 count for ishftc is not positive
42 array_result
= ishftc([3,3], [-2,-2], const_arr3
)
43 !ERROR: SIZE=0 count for ishftc is not positive
44 array_result
= ishftc([3,3], [-2,-2], const_arr4
)
45 !ERROR: SIZE=0 count for ishftc is not positive
46 array_result
= ishftc([3,3], [-2,-2], const_arr5
)
47 !ERROR: SIZE=0 count for ishftc is not positive
48 array_result
= ishftc([3,3], [-2,-2], const_arr6
)
49 !ERROR: SIZE=0 count for ishftc is not positive
50 array_result
= ishftc([3,3], [-2,-2], const_arr7
)
51 array_result
= ishftc([(j
,integer::j
=1,0)], 10, 9) ! ok because empty
52 end program test_ishftc