1! RUN: %python %S/test_errors.py %s %flang_fc1 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 56subroutine s4 57 integer :: x1 = 0, x2(2) = 0 58 logical :: l1 = .false., l2(2) = (/.true., .false./), l3 = .false. 59 !ERROR: The mask or variable must not be scalar 60 where (l1) 61 !ERROR: The mask or variable must not be scalar 62 x1 = 1 63 end where 64 !ERROR: The mask or variable must not be scalar 65 where (l1) 66 !ERROR: The mask or variable must not be scalar 67 where (l3) 68 !ERROR: The mask or variable must not be scalar 69 x1 = 1 70 end where 71 end where 72 !ERROR: The mask or variable must not be scalar 73 where (l2(2)) 74 !ERROR: The mask or variable must not be scalar 75 x2(2) = 1 76 end where 77end 78