! { dg-do run } ! { dg-additional-options "-fno-inline -fno-ipa-modref -fdump-tree-optimized -fdump-tree-original" } ! ! PR fortran/41453 ! Check that the INTENT(OUT) attribute causes one clobber to be emitted ! for the array element passed as argument in the *.original dump, and the ! associated initialization constant to be optimized away in the *.optimized ! dump, whereas the other initialization constants are not optimized away. module x implicit none contains subroutine foo(a) integer, intent(out) :: a a = 42 end subroutine foo end module x program main use x implicit none integer :: ac(3) ac(1) = 123 ac(2) = 456 ac(3) = 789 call foo(ac(2)) if (any(ac /= [123, 42, 789])) stop 1 end program main ! { dg-final { scan-tree-dump-times "CLOBBER" 1 "original" } } ! { dg-final { scan-tree-dump "ac\\\[1\\\] = {CLOBBER};" "original" } } ! { dg-final { scan-tree-dump "123" "original" } } ! { dg-final { scan-tree-dump "123" "optimized" } } ! { dg-final { scan-tree-dump "456" "original" } } ! { dg-final { scan-tree-dump-not "456" "optimized" { target __OPTIMIZE__ } } } ! { dg-final { scan-tree-dump "789" "original" } } ! { dg-final { scan-tree-dump "789" "optimized" } }