2014-01-30 Alangi Derick <alangiderick@gmail.com>
[official-gcc.git] / gcc / testsuite / gfortran.dg / minloc_2.f90
blob7a659f786c9521c083a7df8ca03544ae7399ca81
1 ! { dg-do run }
2 integer :: a(3), h, ia(1)
3 integer, allocatable :: c(:)
4 logical :: l
5 logical :: l2(3)
7 h = -huge(h)
8 h = h - 1
9 allocate (c(3))
10 a(:) = 5
11 ia = minloc (a)
12 if (ia(1).ne.1) call abort
13 a(2) = h
14 ia = minloc (a)
15 if (ia(1).ne.2) call abort
16 a(:) = huge(h)
17 ia = minloc (a)
18 if (ia(1).ne.1) call abort
19 a(3) = huge(h) - 1
20 ia = minloc (a)
21 if (ia(1).ne.3) call abort
22 c(:) = 5
23 ia = minloc (c)
24 if (ia(1).ne.1) call abort
25 c(2) = h
26 ia = minloc (c)
27 if (ia(1).ne.2) call abort
28 c(:) = huge(h)
29 ia = minloc (c)
30 if (ia(1).ne.1) call abort
31 c(3) = huge(h) - 1
32 ia = minloc (c)
33 if (ia(1).ne.3) call abort
34 l = .false.
35 l2(:) = .false.
36 a(:) = 5
37 ia = minloc (a, mask = l)
38 if (ia(1).ne.0) call abort
39 ia = minloc (a, mask = l2)
40 if (ia(1).ne.0) call abort
41 a(2) = h
42 ia = minloc (a, mask = l)
43 if (ia(1).ne.0) call abort
44 ia = minloc (a, mask = l2)
45 if (ia(1).ne.0) call abort
46 a(:) = huge(h)
47 ia = minloc (a, mask = l)
48 if (ia(1).ne.0) call abort
49 ia = minloc (a, mask = l2)
50 if (ia(1).ne.0) call abort
51 a(3) = huge(h) - 1
52 ia = minloc (a, mask = l)
53 if (ia(1).ne.0) call abort
54 ia = minloc (a, mask = l2)
55 if (ia(1).ne.0) call abort
56 c(:) = 5
57 ia = minloc (c, mask = l)
58 if (ia(1).ne.0) call abort
59 ia = minloc (c, mask = l2)
60 if (ia(1).ne.0) call abort
61 c(2) = h
62 ia = minloc (c, mask = l)
63 if (ia(1).ne.0) call abort
64 ia = minloc (c, mask = l2)
65 if (ia(1).ne.0) call abort
66 c(:) = huge(h)
67 ia = minloc (c, mask = l)
68 if (ia(1).ne.0) call abort
69 ia = minloc (c, mask = l2)
70 if (ia(1).ne.0) call abort
71 c(3) = huge(h) - 1
72 ia = minloc (c, mask = l)
73 if (ia(1).ne.0) call abort
74 ia = minloc (c, mask = l2)
75 if (ia(1).ne.0) call abort
76 l = .true.
77 l2(:) = .true.
78 a(:) = 5
79 ia = minloc (a, mask = l)
80 if (ia(1).ne.1) call abort
81 ia = minloc (a, mask = l2)
82 if (ia(1).ne.1) call abort
83 a(2) = h
84 ia = minloc (a, mask = l)
85 if (ia(1).ne.2) call abort
86 ia = minloc (a, mask = l2)
87 if (ia(1).ne.2) call abort
88 a(:) = huge(h)
89 ia = minloc (a, mask = l)
90 if (ia(1).ne.1) call abort
91 ia = minloc (a, mask = l2)
92 if (ia(1).ne.1) call abort
93 a(3) = huge(h) - 1
94 ia = minloc (a, mask = l)
95 if (ia(1).ne.3) call abort
96 ia = minloc (a, mask = l2)
97 if (ia(1).ne.3) call abort
98 c(:) = 5
99 ia = minloc (c, mask = l)
100 if (ia(1).ne.1) call abort
101 ia = minloc (c, mask = l2)
102 if (ia(1).ne.1) call abort
103 c(2) = h
104 ia = minloc (c, mask = l)
105 if (ia(1).ne.2) call abort
106 ia = minloc (c, mask = l2)
107 if (ia(1).ne.2) call abort
108 c(:) = huge(h)
109 ia = minloc (c, mask = l)
110 if (ia(1).ne.1) call abort
111 ia = minloc (c, mask = l2)
112 if (ia(1).ne.1) call abort
113 c(3) = huge(h) - 1
114 ia = minloc (c, mask = l)
115 if (ia(1).ne.3) call abort
116 ia = minloc (c, mask = l2)
117 if (ia(1).ne.3) call abort
118 deallocate (c)
119 allocate (c(-2:-3))
120 ia = minloc (c)
121 if (ia(1).ne.0) call abort