OSDN Git Service

PR target/35944
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / forall_10.f90
1 ! { dg-do run }
2 ! { dg-options "-O" }
3 ! Tests the fix for PR30400, in which the use of ANY in the
4 ! FORALL mask was rejected.
5 !
6 ! Contributed by Dominique d'Humieres <dominiq@lps.ens.fr>
7 !
8 program pr30400_1
9   real, dimension (5, 5, 5, 5) :: a
10
11   a (:, :, :,  :)  = 4
12   a (:, 2, :, 4) = 10
13   a (:, 2, :, 1) = 0
14
15   forall (i = 1:5, j = 1:5, k = 1:5, any (a (i, j, k,  :)  .gt. 6))
16     forall (l = 1:5, any (a (:, :, :, l) .lt. 2))
17       a (i, j, k, l) = i - j + k - l
18     end forall
19   end forall
20   if (sum (a) .ne. 2625.0) call abort ()
21
22  ! Check that the fix has not broken the treatment of the '=='
23   forall (i = 1:5, i == 3) a(i, i, i, i) = -5
24   if (sum (a) .ne. 2616.0) call abort ()
25 end