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