OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gfortran.dg/] [associate_6.f03] - Blame information for rev 801

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 694 jeremybenn
! { dg-do compile }
2
! { dg-options "-std=f2003 -fdump-tree-original" }
3
 
4
! PR fortran/38936
5
! Check that array expression association (with correct bounds) works for
6
! complicated expressions.
7
 
8
! Contributed by Daniel Kraft, d@domob.eu.
9
 
10
MODULE m
11
  IMPLICIT NONE
12
 
13
CONTAINS
14
 
15
  PURE FUNCTION func (n)
16
    INTEGER, INTENT(IN) :: n
17
    INTEGER :: func(2 : n+1)
18
 
19
    INTEGER :: i
20
 
21
    func = (/ (i, i = 1, n) /)
22
  END FUNCTION func
23
 
24
END MODULE m
25
 
26
PROGRAM main
27
  USE :: m
28
  IMPLICIT NONE
29
 
30
  ASSOCIATE (arr => func (4))
31
    ! func should only be called once here, not again for the bounds!
32
 
33
    IF (LBOUND (arr, 1) /= 1 .OR. UBOUND (arr, 1) /= 4) CALL abort ()
34
    IF (arr(1) /= 1 .OR. arr(4) /= 4) CALL abort ()
35
  END ASSOCIATE
36
END PROGRAM main
37
! { dg-final { cleanup-modules "m" } }
38
! { dg-final { scan-tree-dump-times "func" 2 "original" } }
39
! { dg-final { cleanup-tree-dump "original" } }

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.