[LoopReroll] Add an extra defensive check to avoid SCEV assertion.
[llvm-project.git] / flang / test / Semantics / resolve67.f90
blob2c554af29c8c793455cdf3c0349747da50656ca7
1 ! RUN: %S/test_errors.sh %s %t %flang_fc1
2 ! REQUIRES: shell
3 ! Test restrictions on what subprograms can be used for defined operators.
4 ! See: 15.4.3.4.2
6 module m1
7 interface operator(+)
8 !ERROR: OPERATOR(+) procedure 'add1' must be a function
9 subroutine add1(x, y, z)
10 real, intent(out) :: x
11 real, intent(in) :: y, z
12 end
13 end interface
14 end
16 module m2
17 interface operator(-)
18 real function sub1(x)
19 logical, intent(in) :: x
20 end
21 real function sub2(x, y)
22 logical, intent(in) :: x, y
23 end
24 !ERROR: OPERATOR(-) function 'sub3' must have one or two dummy arguments
25 real function sub3(x, y, z)
26 real, intent(in) :: x, y, z
27 end
28 end interface
29 interface operator(.not.)
30 !ERROR: OPERATOR(.NOT.) function 'not1' must have one dummy argument
31 real function not1(x, y)
32 real, intent(in) :: x, y
33 end
34 end interface
35 end
37 module m3
38 interface operator(/)
39 !ERROR: OPERATOR(/) function 'divide' may not have assumed-length CHARACTER(*) result
40 character(*) function divide(x, y)
41 character(*), intent(in) :: x, y
42 end
43 end interface
44 interface operator(<)
45 !ERROR: In OPERATOR(<) function 'lt1', dummy argument 'x' must have INTENT(IN) or VALUE attribute
46 !ERROR: In OPERATOR(<) function 'lt1', dummy argument 'y' may not be OPTIONAL
47 logical function lt1(x, y)
48 logical :: x
49 real, value, optional :: y
50 end
51 !ERROR: In OPERATOR(<) function 'lt2', dummy argument 'y' must be a data object
52 logical function lt2(x, y)
53 logical, intent(in) :: x
54 intent(in) :: y
55 interface
56 subroutine y()
57 end
58 end interface
59 end
60 end interface
61 end
63 module m4
64 interface operator(+)
65 !ERROR: OPERATOR(+) function 'add' conflicts with intrinsic operator
66 complex function add(x, y)
67 real, intent(in) :: x
68 integer, value :: y
69 end
70 !ERROR: OPERATOR(+) function 'plus' conflicts with intrinsic operator
71 real function plus(x)
72 complex, intent(in) :: x
73 end
74 end interface
75 interface operator(.not.)
76 real function not1(x)
77 real, value :: x
78 end
79 !ERROR: OPERATOR(.NOT.) function 'not2' conflicts with intrinsic operator
80 logical(8) function not2(x)
81 logical(8), value :: x
82 end
83 end interface
84 interface operator(.and.)
85 !ERROR: OPERATOR(.AND.) function 'and' conflicts with intrinsic operator
86 real function and(x, y)
87 logical(1), value :: x
88 logical(8), value :: y
89 end
90 end interface
91 interface operator(//)
92 real function concat1(x, y)
93 real, value :: x, y
94 end
95 real function concat2(x, y)
96 character(kind=1, len=4), intent(in) :: x
97 character(kind=4, len=4), intent(in) :: y
98 end
99 !ERROR: OPERATOR(//) function 'concat3' conflicts with intrinsic operator
100 real function concat3(x, y)
101 character(kind=4, len=4), intent(in) :: x
102 character(kind=4, len=4), intent(in) :: y
104 end interface