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