1! RUN: %python %S/test_errors.py %s %flang_fc1
2! Check for semantic errors in ishftc() function calls
3
4program test_ishftc
5  use iso_fortran_env, only: int8, int16, int32, int64
6  implicit none
7
8  integer :: n
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]
17
18  n = ishftc(3, 2, 3)
19  array_result = ishftc([3,3], [2,2], [3,3])
20
21  !ERROR: 'size=' argument for intrinsic 'ishftc' must be a positive value, but is -3
22  n = ishftc(3, 2, -3)
23  !ERROR: 'size=' argument for intrinsic 'ishftc' must be a positive value, but is 0
24  n = ishftc(3, 2, 0)
25  !ERROR: The absolute value of the 'shift=' argument for intrinsic 'ishftc' must be less than or equal to the 'size=' argument
26  n = ishftc(3, 2, 1)
27  !ERROR: The absolute value of the 'shift=' argument for intrinsic 'ishftc' must be less than or equal to the 'size=' argument
28  n = ishftc(3, -2, 1)
29  !ERROR: 'size=' argument for intrinsic 'ishftc' must contain all positive values
30  array_result = ishftc([3,3], [2,2], [-3,3])
31  !ERROR: 'size=' argument for intrinsic 'ishftc' must contain all positive values
32  array_result = ishftc([3,3], [2,2], [-3,-3])
33  !ERROR: 'size=' argument for intrinsic 'ishftc' must contain all positive values
34  array_result = ishftc([3,3], [-2,-2], const_arr1)
35  !ERROR: 'size=' argument for intrinsic 'ishftc' must contain all positive values
36  array_result = ishftc([3,3], [-2,-2], const_arr2)
37  !ERROR: 'size=' argument for intrinsic 'ishftc' must contain all positive values
38  array_result = ishftc([3,3], [-2,-2], const_arr3)
39  !ERROR: 'size=' argument for intrinsic 'ishftc' must contain all positive values
40  array_result = ishftc([3,3], [-2,-2], const_arr4)
41  !ERROR: 'size=' argument for intrinsic 'ishftc' must contain all positive values
42  array_result = ishftc([3,3], [-2,-2], const_arr5)
43  !ERROR: 'size=' argument for intrinsic 'ishftc' must contain all positive values
44  array_result = ishftc([3,3], [-2,-2], const_arr6)
45  !ERROR: 'size=' argument for intrinsic 'ishftc' must contain all positive values
46  array_result = ishftc([3,3], [-2,-2], const_arr7)
47
48end program test_ishftc
49