1 ! RUN: %python %S/test_errors.py %s %flang_fc1
5 character(len
=len
) :: ch
8 pure
real function f(x
,y
)
9 real, intent(in
) :: x
, y
12 impure
real function f1(x
,y
)
17 real, intent(in
) :: x
, y
20 pure
real function f3(x
,y
,z
)
21 real, intent(in
) :: x
, y
, z
24 pure
real function f4(x
,y
)
26 pure
real function x(); end function
27 pure
real function y(); end function
31 pure
integer function f5(x
,y
)
32 real, intent(in
) :: x
, y
35 pure
real function f6(x
,y
)
36 real, intent(in
) :: x(*), y(*)
39 pure
real function f7(x
,y
)
40 real, intent(in
), allocatable
:: x
44 pure
real function f8(x
,y
)
45 real, intent(in
), pointer :: x
49 pure
real function f9(x
,y
)
50 real, intent(in
), optional
:: x
54 pure
real function f10a(x
,y
)
55 real, intent(in
), asynchronous
:: x
59 pure
real function f10b(x
,y
)
60 real, intent(in
), target
:: x
64 pure
real function f10c(x
,y
)
65 real, intent(in
), value
:: x
69 pure
function f11(x
,y
) result(res
)
70 type(pdt(*)), intent(in
) :: x
, y
71 type(pdt(max(x
%len
, y
%len
))) :: res
76 real :: a(10,10), b
, c(10)
77 !ERROR: OPERATION= argument of REDUCE() must be a pure function of two data arguments
79 !ERROR: OPERATION= argument of REDUCE() must be a scalar function
81 !ERROR: OPERATION= argument of REDUCE() must be a pure function of two data arguments
83 !ERROR: OPERATION= argument of REDUCE() may not have dummy procedure arguments
85 !ERROR: OPERATION= argument of REDUCE() must have the same type as ARRAY=
87 !ERROR: Arguments of OPERATION= procedure of REDUCE() must be both scalar of the same type as ARRAY=, and neither allocatable, pointer, polymorphic, nor optional
89 !ERROR: Arguments of OPERATION= procedure of REDUCE() must be both scalar of the same type as ARRAY=, and neither allocatable, pointer, polymorphic, nor optional
91 !ERROR: Arguments of OPERATION= procedure of REDUCE() must be both scalar of the same type as ARRAY=, and neither allocatable, pointer, polymorphic, nor optional
93 !ERROR: Arguments of OPERATION= procedure of REDUCE() must be both scalar of the same type as ARRAY=, and neither allocatable, pointer, polymorphic, nor optional
95 !ERROR: If either argument of the OPERATION= procedure of REDUCE() has the ASYNCHRONOUS, TARGET, or VALUE attribute, both must have that attribute
97 !ERROR: If either argument of the OPERATION= procedure of REDUCE() has the ASYNCHRONOUS, TARGET, or VALUE attribute, both must have that attribute
99 !ERROR: If either argument of the OPERATION= procedure of REDUCE() has the ASYNCHRONOUS, TARGET, or VALUE attribute, both must have that attribute
101 !ERROR: IDENTITY= must be present when the array is empty and the result is scalar
102 b
= reduce(a(1:0,:), f
)
103 !ERROR: IDENTITY= must be present when the array is empty and the result is scalar
104 b
= reduce(a(1:0, 1), f
, dim
=1)
105 !ERROR: IDENTITY= must be present when DIM=1 and the array has zero extent on that dimension
106 c
= reduce(a(1:0, :), f
, dim
=1)
107 !ERROR: IDENTITY= must be present when DIM=1 and the array has zero extent on that dimension
108 c
= reduce(a(1:0, :), f
, dim
=1)
109 !ERROR: IDENTITY= must be present when DIM=2 and the array has zero extent on that dimension
110 c
= reduce(a(:, 1:0), f
, dim
=2)
111 c(1:0) = reduce(a(1:0, 1:0), f
, dim
=1) ! ok, result is empty
112 c(1:0) = reduce(a(1:0, 1:0), f
, dim
=2) ! ok, result is empty
113 !ERROR: MASK= has no .TRUE. element, so IDENTITY= must be present
114 b
= reduce(a
, f
, .false
.)
115 !ERROR: MASK= has no .TRUE. element, so IDENTITY= must be present
116 b
= reduce(a
, f
, reshape([(j
> 100, j
=1, 100)], shape(a
)))
117 b
= reduce(a
, f
, reshape([(j
== 50, j
=1, 100)], shape(a
))) ! ok
119 subroutine not_errors
120 type(pdt(10)) :: a(10), b
121 b
= reduce(a
, f11
) ! check no bogus type incompatibility diagnostic