35 lines · plain
1! RUN: %python %S/test_errors.py %s %flang_fc1 -Wportability2! A potentially absent actual argument cannot require data type conversion.3subroutine s(o,a,p)4 integer(2), intent(in), optional :: o5 integer(2), intent(in), allocatable :: a6 integer(2), intent(in), pointer :: p7 !ERROR: An actual argument to MAX/MIN requiring data conversion may not be OPTIONAL, POINTER, or ALLOCATABLE8 print *, max(1, 2, o)9 !ERROR: An actual argument to MAX/MIN requiring data conversion may not be OPTIONAL, POINTER, or ALLOCATABLE10 print *, max(1, 2, a)11 !ERROR: An actual argument to MAX/MIN requiring data conversion may not be OPTIONAL, POINTER, or ALLOCATABLE12 print *, max(1, 2, p)13 !ERROR: An actual argument to MAX/MIN requiring data conversion may not be OPTIONAL, POINTER, or ALLOCATABLE14 print *, min(1, 2, o)15 !ERROR: An actual argument to MAX/MIN requiring data conversion may not be OPTIONAL, POINTER, or ALLOCATABLE16 print *, min(1, 2, a)17 !ERROR: An actual argument to MAX/MIN requiring data conversion may not be OPTIONAL, POINTER, or ALLOCATABLE18 print *, min(1, 2, p)19 print *, max(1_2, 2_2, o) ! ok20 print *, max(1_2, 2_2, a) ! ok21 print *, max(1_2, 2_2, p) ! ok22 print *, min(1_2, 2_2, o) ! ok23 print *, min(1_2, 2_2, a) ! ok24 print *, min(1_2, 2_2, p) ! ok25end26 27subroutine ichar_tests()28 integer, parameter :: a1 = ichar('B')29 !WARNING: Character in intrinsic function ichar should have length one [-Wportability]30 integer, parameter :: a2 = ichar('B ')31 !ERROR: Character in intrinsic function ichar must have length one32 !ERROR: Value of named constant 'a3' (ichar("")) cannot be computed as a constant value33 integer, parameter :: a3 = ichar('')34end subroutine35