1! { dg-do compile }
2! PR 25423: Nested WHERE constructs.
3program nested_where
4
5    implicit none
6    integer :: a(4)
7    logical :: mask1(4) = (/.TRUE., .TRUE., .FALSE., .FALSE./), &
8               mask2(4) = (/.TRUE., .FALSE., .TRUE., .FALSE./)
9
10    where (mask1)
11        where (mask2)
12            a = 1
13        elsewhere
14            a = 2
15        end where
16    elsewhere
17        where (mask2)
18            a = 3
19        elsewhere
20            a = 4
21        end where
22    end where
23
24    print *, a
25
26end program nested_where
27