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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gfortran.dg/] [aliasing_dummy_5.f90] - Blame information for rev 774

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

Line No. Rev Author Line
1 694 jeremybenn
! { dg-do run }
2
!
3
! PR fortran/45019
4
!
5
! Check that the compiler knows that
6
! "arg" and "arr" can alias.
7
!
8
MODULE m
9
  IMPLICIT NONE
10
  INTEGER, TARGET :: arr(3)
11
CONTAINS
12
  SUBROUTINE foobar (arg)
13
    INTEGER, TARGET :: arg(:)
14
    arr(2:3) = arg(1:2)
15
  END SUBROUTINE foobar
16
END MODULE m
17
 
18
PROGRAM main
19
  USE m
20
  IMPLICIT NONE
21
  arr = (/ 1, 2, 3 /)
22
  CALL bar(arr)
23
  if (any (arr /= (/ 1, 1, 2 /))) call abort()
24
  CALL test()
25
contains
26
  subroutine bar(x)
27
    INTEGER, TARGET :: x(:)
28
    CALL foobar (x)
29
  end subroutine bar
30
END PROGRAM main
31
 
32
MODULE m2
33
  IMPLICIT NONE
34
  INTEGER, TARGET :: arr(3)
35
CONTAINS
36
   SUBROUTINE foobar (arg)
37
    INTEGER, TARGET :: arg(:)
38
    arr(1) = 5
39
    arg(1) = 6
40
    if (arr(1) == 5) call abort()
41
  END SUBROUTINE foobar
42
END MODULE m2
43
subroutine test
44
  USE m2
45
  IMPLICIT NONE
46
  arr = (/ 1, 2, 3 /)
47
  CALL bar(arr)
48
contains
49
   subroutine bar(x)
50
    INTEGER, TARGET :: x(:)
51
    CALL foobar (x)
52
  end subroutine bar
53
END subroutine test
54
 
55
! { dg-final { cleanup-modules "m m2" } }

powered by: WebSVN 2.1.0

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