| 1 |
! { dg-do run } |
| 2 |
! { dg-additional-options "-fno-inline -fno-ipa-modref -fdump-tree-optimized -fdump-tree-original" } |
| 3 |
! |
| 4 |
! PR fortran/41453 |
| 5 |
! Check that the INTENT(OUT) attribute causes one clobber to be emitted in |
| 6 |
! the caller before each call to FOO in the *.original dump, and the |
| 7 |
! initialization constant to be optimized away in the *.optimized dump, |
| 8 |
! in the case of an argument passed by reference to the caller. |
| 9 |
|
| 10 |
module x |
| 11 |
implicit none |
| 12 |
contains |
| 13 |
subroutine foo(a) |
| 14 |
integer(kind=4), intent(out) :: a |
| 15 |
a = 42 |
| 16 |
end subroutine foo |
| 17 |
subroutine bar(b) |
| 18 |
integer(kind=4) :: b |
| 19 |
b = 123456789 |
| 20 |
call foo(b) |
| 21 |
end subroutine bar |
| 22 |
end module x |
| 23 |
|
| 24 |
program main |
| 25 |
use x |
| 26 |
implicit none |
| 27 |
integer(kind=4) :: c |
| 28 |
call bar(c) |
| 29 |
if (c /= 42) stop 1 |
| 30 |
end program main |
| 31 |
|
| 32 |
! { dg-final { scan-tree-dump-times "CLOBBER" 1 "original" } } |
| 33 |
! { dg-final { scan-tree-dump "\\*\\\(integer\\\(kind=4\\\) \\*\\\) b = {CLOBBER};" "original" } } |
| 34 |
! { dg-final { scan-tree-dump-not "123456789" "optimized" { target __OPTIMIZE__ } } } |