2 ! { dg-options "-fbounds-check" }
3 ! Tests the fix for PR30003, in which the 'end' of an array section
4 ! would not be evaluated at all if it was on the lhs of an assignment
5 ! or would be evaluated many times if bound checking were on.
7 ! Contributed by Erik Edelmann <eedelmann@gcc.gnu.org>
10 integer :: a(5), b(3), cnt
13 ! Check the lhs references
16 if (cnt
/= 1) call abort ()
19 if (cnt
/= 1) call abort ()
22 if (cnt
/= 1) call abort ()
23 ! Check the rhs references
26 if (cnt
/= 1) call abort ()
29 if (cnt
/= 1) call abort ()
31 a(1:3) = b(1:3:bar(1))
32 if (cnt
/= 1) call abort ()
34 integer function bar(n
)
35 integer, intent(in
) :: n