Debian Codegraph @

gcc/testsuite/gfortran.fortran-torture/execute/where20.f90

raw
1 ! Test the dependency checking in simple where. This
2 ! did not work and was fixed as part of the patch for
3 ! pr24519.
4 !
5 program where_20
6 integer :: a(4)
7 integer :: b(3)
8 integer :: c(3)
9 integer :: d(3) = (/1, 2, 3/)
10 equivalence (a(1), b(1)), (a(2), c(1))
11
12 ! This classic case worked before the patch.
13 a = (/1, 2, 3, 4/)
14 where (b .gt. 1) a(2:4) = a(1:3)
15 if (any(a .ne. (/1,2,2,3/))) STOP 1
16
17 ! This is the original manifestation of the problem
18 ! and is repeated in where_19.f90.
19 a = (/1, 2, 3, 4/)
20 where (b .gt. 1)
21 c = b
22 endwhere
23 if (any(a .ne. (/1,2,2,3/))) STOP 2
24
25 ! Mask to.destination dependency.
26 a = (/1, 2, 3, 4/)
27 where (b .gt. 1)
28 c = d
29 endwhere
30 if (any(a .ne. (/1,2,2,3/))) STOP 3
31
32 ! Source to.destination dependency.
33 a = (/1, 2, 3, 4/)
34 where (d .gt. 1)
35 c = b
36 endwhere
37 if (any(a .ne. (/1,2,2,3/))) STOP 4
38
39 ! Check the simple where.
40 a = (/1, 2, 3, 4/)
41 where (b .gt. 1) c = b
42 if (any(a .ne. (/1,2,2,3/))) STOP 5
43
44 ! This was OK before the patch.
45 a = (/1, 2, 3, 4/)
46 where (b .gt. 1)
47 where (d .gt. 1)
48 c = b
49 end where
50 endwhere
51 if (any(a .ne. (/1,2,2,3/))) STOP 6
52
53 end program
54