hppa64: Fix fmt_f_default_field_width_3.f90 and fmt_g_default_field_width_3.f90
[official-gcc.git] / gcc / testsuite / gfortran.dg / maxlocval_4.f90
blobf8f90fd0571e040aa44fb838e7315484cc32680f
1 ! { dg-do run }
2 ! { dg-add-options ieee }
3 real :: a(3,3), b(3), nan, minf, pinf, h
4 logical :: l, l2
5 logical :: l3(3,3), l4(3,3), l5(3,3)
7 nan = 0.0
8 minf = 0.0
9 pinf = 0.0
10 nan = 0.0/nan
11 minf = -1.0/minf
12 pinf = 1.0/pinf
13 h = -huge(h)
14 l = .false.
15 l2 = .true.
16 l3 = .false.
17 l4 = .true.
18 l5 = .true.
19 l5(1,1) = .false.
20 l5(1,2) = .false.
21 l5(2,3) = .false.
22 a = reshape ((/ nan, nan, nan, minf, minf, minf, minf, pinf, minf /), (/ 3, 3 /))
23 if (maxval (a).ne.pinf) STOP 1
24 if (any (maxloc (a).ne.(/ 2, 3 /))) STOP 2
25 b = maxval (a, dim = 1)
26 if (.not.isnan(b(1))) STOP 3
27 b(1) = 0.0
28 if (any (b.ne.(/ 0.0, minf, pinf /))) STOP 4
29 if (any (maxloc (a, dim = 1).ne.(/ 1, 1, 2 /))) STOP 5
30 b = maxval (a, dim = 2)
31 if (any (b.ne.(/ minf, pinf, minf /))) STOP 6
32 if (any (maxloc (a, dim = 2).ne.(/ 2, 3, 2 /))) STOP 7
33 if (maxval (a, mask = l).ne.h) STOP 8
34 if (any (maxloc (a, mask = l).ne.(/ 0, 0 /))) STOP 9
35 b = maxval (a, dim = 1, mask = l)
36 if (any (b.ne.(/ h, h, h /))) STOP 10
37 if (any (maxloc (a, dim = 1, mask = l).ne.(/ 0, 0, 0 /))) STOP 11
38 b = maxval (a, dim = 2, mask = l)
39 if (any (b.ne.(/ h, h, h /))) STOP 12
40 if (any (maxloc (a, dim = 2, mask = l).ne.(/ 0, 0, 0 /))) STOP 13
41 if (maxval (a, mask = l3).ne.h) STOP 14
42 if (any (maxloc (a, mask = l3).ne.(/ 0, 0 /))) STOP 15
43 b = maxval (a, dim = 1, mask = l3)
44 if (any (b.ne.(/ h, h, h /))) STOP 16
45 if (any (maxloc (a, dim = 1, mask = l3).ne.(/ 0, 0, 0 /))) STOP 17
46 b = maxval (a, dim = 2, mask = l3)
47 if (any (b.ne.(/ h, h, h /))) STOP 18
48 if (any (maxloc (a, dim = 2, mask = l3).ne.(/ 0, 0, 0 /))) STOP 19
49 if (maxval (a, mask = l2).ne.pinf) STOP 20
50 if (maxval (a, mask = l4).ne.pinf) STOP 21
51 if (any (maxloc (a, mask = l2).ne.(/ 2, 3 /))) STOP 22
52 if (any (maxloc (a, mask = l4).ne.(/ 2, 3 /))) STOP 23
53 b = maxval (a, dim = 1, mask = l2)
54 if (.not.isnan(b(1))) STOP 24
55 b(1) = 0.0
56 if (any (b.ne.(/ 0.0, minf, pinf /))) STOP 25
57 if (any (maxloc (a, dim = 1, mask = l2).ne.(/ 1, 1, 2 /))) STOP 26
58 b = maxval (a, dim = 2, mask = l2)
59 if (any (b.ne.(/ minf, pinf, minf /))) STOP 27
60 if (any (maxloc (a, dim = 2, mask = l2).ne.(/ 2, 3, 2 /))) STOP 28
61 b = maxval (a, dim = 1, mask = l4)
62 if (.not.isnan(b(1))) STOP 29
63 b(1) = 0.0
64 if (any (b.ne.(/ 0.0, minf, pinf /))) STOP 30
65 if (any (maxloc (a, dim = 1, mask = l2).ne.(/ 1, 1, 2 /))) STOP 31
66 b = maxval (a, dim = 2, mask = l4)
67 if (any (b.ne.(/ minf, pinf, minf /))) STOP 32
68 if (any (maxloc (a, dim = 2, mask = l2).ne.(/ 2, 3, 2 /))) STOP 33
69 if (maxval (a, mask = l5).ne.minf) STOP 34
70 if (any (maxloc (a, mask = l5).ne.(/ 2, 2 /))) STOP 35
71 b = maxval (a, dim = 1, mask = l5)
72 if (.not.isnan(b(1))) STOP 36
73 b(1) = 0.0
74 if (any (b.ne.(/ 0.0, minf, minf /))) STOP 37
75 if (any (maxloc (a, dim = 1, mask = l5).ne.(/ 2, 2, 1 /))) STOP 38
76 b = maxval (a, dim = 2, mask = l5)
77 if (any (b.ne.(/ minf, minf, minf /))) STOP 39
78 if (any (maxloc (a, dim = 2, mask = l5).ne.(/ 3, 2, 2 /))) STOP 40
79 a = nan
80 if (.not.isnan(maxval (a))) STOP 41
81 if (maxval (a, mask = l).ne.h) STOP 42
82 if (.not.isnan(maxval (a, mask = l2))) STOP 43
83 if (maxval (a, mask = l3).ne.h) STOP 44
84 if (.not.isnan(maxval (a, mask = l4))) STOP 45
85 if (.not.isnan(maxval (a, mask = l5))) STOP 46
86 if (any (maxloc (a).ne.(/ 1, 1 /))) STOP 47
87 if (any (maxloc (a, mask = l).ne.(/ 0, 0 /))) STOP 48
88 if (any (maxloc (a, mask = l2).ne.(/ 1, 1 /))) STOP 49
89 if (any (maxloc (a, mask = l3).ne.(/ 0, 0 /))) STOP 50
90 if (any (maxloc (a, mask = l4).ne.(/ 1, 1 /))) STOP 51
91 if (any (maxloc (a, mask = l5).ne.(/ 2, 1 /))) STOP 52
92 a = minf
93 if (maxval (a).ne.minf) STOP 53
94 if (maxval (a, mask = l).ne.h) STOP 54
95 if (maxval (a, mask = l2).ne.minf) STOP 55
96 if (maxval (a, mask = l3).ne.h) STOP 56
97 if (maxval (a, mask = l4).ne.minf) STOP 57
98 if (maxval (a, mask = l5).ne.minf) STOP 58
99 if (any (maxloc (a).ne.(/ 1, 1 /))) STOP 59
100 if (any (maxloc (a, mask = l).ne.(/ 0, 0 /))) STOP 60
101 if (any (maxloc (a, mask = l2).ne.(/ 1, 1 /))) STOP 61
102 if (any (maxloc (a, mask = l3).ne.(/ 0, 0 /))) STOP 62
103 if (any (maxloc (a, mask = l4).ne.(/ 1, 1 /))) STOP 63
104 if (any (maxloc (a, mask = l5).ne.(/ 2, 1 /))) STOP 64
105 a = nan
106 a(1,3) = minf
107 if (maxval (a).ne.minf) STOP 65
108 if (maxval (a, mask = l).ne.h) STOP 66
109 if (maxval (a, mask = l2).ne.minf) STOP 67
110 if (maxval (a, mask = l3).ne.h) STOP 68
111 if (maxval (a, mask = l4).ne.minf) STOP 69
112 if (maxval (a, mask = l5).ne.minf) STOP 70
113 if (any (maxloc (a).ne.(/ 1, 3 /))) STOP 71
114 if (any (maxloc (a, mask = l).ne.(/ 0, 0 /))) STOP 72
115 if (any (maxloc (a, mask = l2).ne.(/ 1, 3 /))) STOP 73
116 if (any (maxloc (a, mask = l3).ne.(/ 0, 0 /))) STOP 74
117 if (any (maxloc (a, mask = l4).ne.(/ 1, 3 /))) STOP 75
118 if (any (maxloc (a, mask = l5).ne.(/ 1, 3 /))) STOP 76