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=-3 count for ishftc is not positive 22 n = ishftc(3, 2, -3) 23 !ERROR: SIZE=0 count for ishftc is not positive 24 n = ishftc(3, 2, 0) 25 !ERROR: SHIFT=2 count for ishftc is greater in magnitude than SIZE=1 26 n = ishftc(3, 2, 1) 27 !ERROR: SHIFT=-2 count for ishftc is greater in magnitude than SIZE=1 28 n = ishftc(3, -2, 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 52end program test_ishftc 53