1! RUN: %S/test_errors.sh %s %t %f18
2! 10.2.3.1(2) All masks and LHS of assignments in a WHERE must conform
3
4subroutine s1
5  integer :: a1(10), a2(10)
6  logical :: m1(10), m2(5,5)
7  m1 = .true.
8  m2 = .false.
9  a1 = [((i),i=1,10)]
10  where (m1)
11    a2 = 1
12  !ERROR: Must have rank 1 to match prior mask or assignment of WHERE construct
13  elsewhere (m2)
14    a2 = 2
15  elsewhere
16    a2 = 3
17  end where
18end
19
20subroutine s2
21  logical, allocatable :: m1(:), m4(:,:)
22  logical :: m2(2), m3(3)
23  where(m1)
24    where(m2)
25    end where
26    !ERROR: Dimension 1 must have extent 2 to match prior mask or assignment of WHERE construct
27    where(m3)
28    end where
29    !ERROR: Must have rank 1 to match prior mask or assignment of WHERE construct
30    where(m4)
31    end where
32  endwhere
33  where(m1)
34    where(m3)
35    end where
36  !ERROR: Dimension 1 must have extent 3 to match prior mask or assignment of WHERE construct
37  elsewhere(m2)
38  end where
39end
40
41subroutine s3
42  logical, allocatable :: m1(:,:)
43  logical :: m2(4,2)
44  real :: x(4,4), y(4,4)
45  real :: a(4,5), b(4,5)
46  where(m1)
47    x = y
48    !ERROR: Dimension 2 must have extent 4 to match prior mask or assignment of WHERE construct
49    a = b
50    !ERROR: Dimension 2 must have extent 4 to match prior mask or assignment of WHERE construct
51    where(m2)
52    end where
53  end where
54end
55