! { 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-times "123" 2 "original" } } ! { dg-final { scan-tree-dump-times "123" 2 "optimized" } } ! { dg-final { scan-tree-dump-times "456" 1 "original" } } ! { dg-final { scan-tree-dump-times "456" 0 "optimized" { target __OPTIMIZE__ } } } ! { dg-final { scan-tree-dump-times "789" 2 "original" } } ! { dg-final { scan-tree-dump-times "789" 2 "optimized" } }