| 1 |
! { dg-do run } |
| 2 |
! { dg-additional-options "-fno-inline -fno-ipa-modref -fdump-tree-optimized -fdump-tree-original" } |
| 3 |
! |
| 4 |
! PR fortran/105012 |
| 5 |
! Check that the INTENT(OUT) attribute causes one clobber to be emitted in |
| 6 |
! the caller before the call to Y in the *.original dump, and the |
| 7 |
! initialization constant to be optimized away in the *.optimized dump, |
| 8 |
! despite the non-explicit interface if the subroutine with the INTENT(OUT) |
| 9 |
! is declared in the same file. |
| 10 |
|
| 11 |
SUBROUTINE Y (Z) |
| 12 |
integer, intent(out) :: Z |
| 13 |
Z = 42 |
| 14 |
END SUBROUTINE Y |
| 15 |
PROGRAM TEST |
| 16 |
integer :: X |
| 17 |
X = 123456789 |
| 18 |
CALL Y (X) |
| 19 |
if (X.ne.42) STOP 1 |
| 20 |
END PROGRAM |
| 21 |
|
| 22 |
! { dg-final { scan-tree-dump-times "CLOBBER" 1 "original" } } |
| 23 |
! { dg-final { scan-tree-dump "x = {CLOBBER};" "original" } } |
| 24 |
! { dg-final { scan-tree-dump-not "123456789" "optimized" { target __OPTIMIZE__ } } } |