[Fortran] OpenACC – permit common blocks in some clauses
[official-gcc.git] / gcc / testsuite / gfortran.dg / maxloc_2.f90
blobd9d3100c674533b052a2ba554aa4d2c4e5d440bb
1 ! { dg-do run }
2 ! { dg-add-options ieee }
3 real :: a(3), nan, minf, pinf
4 real, allocatable :: c(:)
5 integer :: ia(1)
6 logical :: l
7 logical :: l2(3)
9 nan = 0.0
10 minf = 0.0
11 pinf = 0.0
12 nan = 0.0/nan
13 minf = -1.0/minf
14 pinf = 1.0/pinf
16 allocate (c(3))
17 a(:) = nan
18 ia = maxloc (a)
19 if (ia(1).ne.1) STOP 1
20 a(:) = minf
21 ia = maxloc (a)
22 if (ia(1).ne.1) STOP 2
23 a(1:2) = nan
24 ia = maxloc (a)
25 if (ia(1).ne.3) STOP 3
26 a(2) = 1.0
27 ia = maxloc (a)
28 if (ia(1).ne.2) STOP 4
29 a(2) = pinf
30 ia = maxloc (a)
31 if (ia(1).ne.2) STOP 5
32 c(:) = nan
33 ia = maxloc (c)
34 if (ia(1).ne.1) STOP 6
35 c(:) = minf
36 ia = maxloc (c)
37 if (ia(1).ne.1) STOP 7
38 c(1:2) = nan
39 ia = maxloc (c)
40 if (ia(1).ne.3) STOP 8
41 c(2) = 1.0
42 ia = maxloc (c)
43 if (ia(1).ne.2) STOP 9
44 c(2) = pinf
45 ia = maxloc (c)
46 if (ia(1).ne.2) STOP 10
47 l = .false.
48 l2(:) = .false.
49 a(:) = nan
50 ia = maxloc (a, mask = l)
51 if (ia(1).ne.0) STOP 11
52 ia = maxloc (a, mask = l2)
53 if (ia(1).ne.0) STOP 12
54 a(:) = minf
55 ia = maxloc (a, mask = l)
56 if (ia(1).ne.0) STOP 13
57 ia = maxloc (a, mask = l2)
58 if (ia(1).ne.0) STOP 14
59 a(1:2) = nan
60 ia = maxloc (a, mask = l)
61 if (ia(1).ne.0) STOP 15
62 ia = maxloc (a, mask = l2)
63 if (ia(1).ne.0) STOP 16
64 a(2) = 1.0
65 ia = maxloc (a, mask = l)
66 if (ia(1).ne.0) STOP 17
67 ia = maxloc (a, mask = l2)
68 if (ia(1).ne.0) STOP 18
69 a(2) = pinf
70 ia = maxloc (a, mask = l)
71 if (ia(1).ne.0) STOP 19
72 ia = maxloc (a, mask = l2)
73 if (ia(1).ne.0) STOP 20
74 c(:) = nan
75 ia = maxloc (c, mask = l)
76 if (ia(1).ne.0) STOP 21
77 ia = maxloc (c, mask = l2)
78 if (ia(1).ne.0) STOP 22
79 c(:) = minf
80 ia = maxloc (c, mask = l)
81 if (ia(1).ne.0) STOP 23
82 ia = maxloc (c, mask = l2)
83 if (ia(1).ne.0) STOP 24
84 c(1:2) = nan
85 ia = maxloc (c, mask = l)
86 if (ia(1).ne.0) STOP 25
87 ia = maxloc (c, mask = l2)
88 if (ia(1).ne.0) STOP 26
89 c(2) = 1.0
90 ia = maxloc (c, mask = l)
91 if (ia(1).ne.0) STOP 27
92 ia = maxloc (c, mask = l2)
93 if (ia(1).ne.0) STOP 28
94 c(2) = pinf
95 ia = maxloc (c, mask = l)
96 if (ia(1).ne.0) STOP 29
97 ia = maxloc (c, mask = l2)
98 if (ia(1).ne.0) STOP 30
99 l = .true.
100 l2(:) = .true.
101 a(:) = nan
102 ia = maxloc (a, mask = l)
103 if (ia(1).ne.1) STOP 31
104 ia = maxloc (a, mask = l2)
105 if (ia(1).ne.1) STOP 32
106 a(:) = minf
107 ia = maxloc (a, mask = l)
108 if (ia(1).ne.1) STOP 33
109 ia = maxloc (a, mask = l2)
110 if (ia(1).ne.1) STOP 34
111 a(1:2) = nan
112 ia = maxloc (a, mask = l)
113 if (ia(1).ne.3) STOP 35
114 ia = maxloc (a, mask = l2)
115 if (ia(1).ne.3) STOP 36
116 a(2) = 1.0
117 ia = maxloc (a, mask = l)
118 if (ia(1).ne.2) STOP 37
119 ia = maxloc (a, mask = l2)
120 if (ia(1).ne.2) STOP 38
121 a(2) = pinf
122 ia = maxloc (a, mask = l)
123 if (ia(1).ne.2) STOP 39
124 ia = maxloc (a, mask = l2)
125 if (ia(1).ne.2) STOP 40
126 c(:) = nan
127 ia = maxloc (c, mask = l)
128 if (ia(1).ne.1) STOP 41
129 ia = maxloc (c, mask = l2)
130 if (ia(1).ne.1) STOP 42
131 c(:) = minf
132 ia = maxloc (c, mask = l)
133 if (ia(1).ne.1) STOP 43
134 ia = maxloc (c, mask = l2)
135 if (ia(1).ne.1) STOP 44
136 c(1:2) = nan
137 ia = maxloc (c, mask = l)
138 if (ia(1).ne.3) STOP 45
139 ia = maxloc (c, mask = l2)
140 if (ia(1).ne.3) STOP 46
141 c(2) = 1.0
142 ia = maxloc (c, mask = l)
143 if (ia(1).ne.2) STOP 47
144 ia = maxloc (c, mask = l2)
145 if (ia(1).ne.2) STOP 48
146 c(2) = pinf
147 ia = maxloc (c, mask = l)
148 if (ia(1).ne.2) STOP 49
149 ia = maxloc (c, mask = l2)
150 if (ia(1).ne.2) STOP 50
151 deallocate (c)
152 allocate (c(-2:-3))
153 ia = maxloc (c)
154 if (ia(1).ne.0) STOP 51