OSDN Git Service

PR debug/43557
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / where_2.f90
1 ! { dg-do run }
2 ! Tests the fix for PR35743 and PR35745.
3 !
4 ! Contributed by Dick Hendrickson <dick.hendrickson@gmail.com>
5 !
6 program try_rg0025
7   logical lda(5)
8   lda = (/(i/2*2 .ne. I, i=1,5)/)
9   call PR35743 (lda,  1,  2,  3,  5,  6, -1, -2)
10   CALL PR34745
11 end program
12
13 ! Previously, the negative mask size would not be detected.
14 SUBROUTINE PR35743 (LDA,nf1,nf2,nf3,nf5,nf6,mf1,mf2)
15   type unseq
16     real  r
17   end type unseq
18   TYPE(UNSEQ) TDA1L(6)
19   LOGICAL LDA(NF5)
20   TDA1L(1:6)%r = 1.0
21   WHERE (LDA(NF6:NF3))
22     TDA1L(MF1:NF5:MF1) = TDA1L(NF6:NF2)
23   ENDWHERE
24 END SUBROUTINE
25
26 ! Previously, the expression in the WHERE block would be evaluated
27 ! ouside the loop generated by the where.
28 SUBROUTINE PR34745
29   INTEGER IDA(10)
30   REAL RDA(10)
31   RDA    = 1.0
32   nf0 = 0
33   WHERE (RDA < -15.0)
34     IDA = 1/NF0 + 2
35   ENDWHERE
36 END SUBROUTINE