[WebAssembly] Fix asan issue from https://reviews.llvm.org/D121349
[llvm-project.git] / flang / test / Semantics / assign01.f90
blob351fecfa103bf5c83ec07be7f66832f8ee0df1ba
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
4 subroutine 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
18 end
20 subroutine 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
39 end
41 subroutine 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
54 end