Merge from mainline
[official-gcc.git] / gcc / testsuite / gfortran.dg / maxval_maxloc_conformance_1.f90
blob828655cbff0694c88501719d1f70baf7d3bf720e
1 ! { dg-do compile }
2 ! PR 26039: Tests for different ranks for (min|max)loc, (min|max)val, product
3 ! and sum were missing.
4 program main
5 integer, dimension(2) :: a
6 logical, dimension(2,1) :: lo
7 logical, dimension(3) :: lo2
8 a = (/ 1, 2 /)
9 lo = .true.
10 print *,minloc(a,mask=lo) ! { dg-error "Incompatible ranks" }
11 print *,maxloc(a,mask=lo) ! { dg-error "Incompatible ranks" }
12 print *,minval(a,mask=lo) ! { dg-error "Incompatible ranks" }
13 print *,maxval(a,mask=lo) ! { dg-error "Incompatible ranks" }
14 print *,sum(a,mask=lo) ! { dg-error "Incompatible ranks" }
15 print *,product(a,mask=lo) ! { dg-error "Incompatible ranks" }
16 print *,minloc(a,1,mask=lo) ! { dg-error "Incompatible ranks" }
17 print *,maxloc(a,1,mask=lo) ! { dg-error "Incompatible ranks" }
18 print *,minval(a,1,mask=lo) ! { dg-error "Incompatible ranks" }
19 print *,maxval(a,1,mask=lo) ! { dg-error "Incompatible ranks" }
20 print *,sum(a,1,mask=lo) ! { dg-error "Incompatible ranks" }
21 print *,product(a,1,mask=lo) ! { dg-error "Incompatible ranks" }
23 print *,minloc(a,mask=lo2) ! { dg-error "different shape" }
24 print *,maxloc(a,mask=lo2) ! { dg-error "different shape" }
25 print *,minval(a,mask=lo2) ! { dg-error "different shape" }
26 print *,maxval(a,mask=lo2) ! { dg-error "different shape" }
27 print *,sum(a,mask=lo2) ! { dg-error "different shape" }
28 print *,product(a,mask=lo2) ! { dg-error "different shape" }
29 print *,minloc(a,1,mask=lo2) ! { dg-error "different shape" }
30 print *,maxloc(a,1,mask=lo2) ! { dg-error "different shape" }
31 print *,minval(a,1,mask=lo2) ! { dg-error "different shape" }
32 print *,maxval(a,1,mask=lo2) ! { dg-error "different shape" }
33 print *,sum(a,1,mask=lo2) ! { dg-error "different shape" }
34 print *,product(a,1,mask=lo2) ! { dg-error "different shape" }
35 end program main