xref: /llvm-project/flang/test/Semantics/intrinsics04.f90 (revision 97e3f605d5b574899d9f012032349bbf84c4dcfb)
1! RUN: %python %S/test_errors.py %s %flang_fc1
2! A potentially absent actual argument cannot require data type conversion.
3subroutine s(o,a,p)
4  integer(2), intent(in), optional :: o
5  integer(2), intent(in), allocatable :: a
6  integer(2), intent(in), pointer :: p
7  !ERROR: An actual argument to MAX/MIN requiring data conversion may not be OPTIONAL, POINTER, or ALLOCATABLE
8  print *, max(1, 2, o)
9  !ERROR: An actual argument to MAX/MIN requiring data conversion may not be OPTIONAL, POINTER, or ALLOCATABLE
10  print *, max(1, 2, a)
11  !ERROR: An actual argument to MAX/MIN requiring data conversion may not be OPTIONAL, POINTER, or ALLOCATABLE
12  print *, max(1, 2, p)
13  !ERROR: An actual argument to MAX/MIN requiring data conversion may not be OPTIONAL, POINTER, or ALLOCATABLE
14  print *, min(1, 2, o)
15  !ERROR: An actual argument to MAX/MIN requiring data conversion may not be OPTIONAL, POINTER, or ALLOCATABLE
16  print *, min(1, 2, a)
17  !ERROR: An actual argument to MAX/MIN requiring data conversion may not be OPTIONAL, POINTER, or ALLOCATABLE
18  print *, min(1, 2, p)
19  print *, max(1_2, 2_2, o) ! ok
20  print *, max(1_2, 2_2, a) ! ok
21  print *, max(1_2, 2_2, p) ! ok
22  print *, min(1_2, 2_2, o) ! ok
23  print *, min(1_2, 2_2, a) ! ok
24  print *, min(1_2, 2_2, p) ! ok
25end
26