* cfgloopmanip.c (duplicate_loop_to_header_edge): Cleanup profile
[official-gcc.git] / gcc / testsuite / gfortran.dg / aliasing_dummy_5.f90
blobcc52456f0d9e2469f45686818491b6ff911d050d
1 ! { dg-do run }
2 !
3 ! PR fortran/45019
5 ! Check that the compiler knows that
6 ! "arg" and "arr" can alias.
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
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
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