2 ! { dg-options "-std=f2003 -fdump-tree-original" }
5 ! Check that array expression association (with correct bounds) works for
6 ! complicated expressions.
8 ! Contributed by Daniel Kraft, d@domob.eu.
15 PURE FUNCTION func (n)
16 INTEGER, INTENT(IN) :: n
17 INTEGER :: func(2 : n+1)
21 func = (/ (i, i = 1, n) /)
30 ASSOCIATE (arr => func (4))
31 ! func should only be called once here, not again for the bounds!
33 IF (LBOUND (arr, 1) /= 1 .OR. UBOUND (arr, 1) /= 4) STOP 1
34 IF (arr(1) /= 1 .OR. arr(4) /= 4) STOP 2
37 ! { dg-final { scan-tree-dump-times "func" 2 "original" } }