hppa64: Fix fmt_f_default_field_width_3.f90 and fmt_g_default_field_width_3.f90
[official-gcc.git] / gcc / testsuite / gfortran.dg / intent_optimize_7.f90
blobc2f21929863b423e3dc216d00e4cb41ba23a29e5
1 ! { dg-do run }
2 ! { dg-additional-options "-fno-inline -fno-ipa-modref -fdump-tree-optimized -fdump-tree-original" }
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 constants to be optimized away in the *.optimized dump,
8 ! in the case of SAVE variables.
10 module x
11 implicit none
12 contains
13 subroutine foo(a)
14 integer, intent(out) :: a
15 a = 42
16 end subroutine foo
17 end module x
19 program main
20 use x
21 implicit none
22 integer :: c = 0
24 ! implicit SAVE attribute
25 c = 123456789
26 call foo(c)
27 if (c /= 42) stop 1
29 ! explicit SAVE attribute
30 call check_save_explicit
32 contains
33 subroutine check_save_explicit
34 integer, save :: d
35 d = 987654321
36 call foo(d)
37 if (d /= 42) stop 2
38 end subroutine check_save_explicit
39 end program main
41 ! { dg-final { scan-tree-dump-times "CLOBBER" 2 "original" } }
42 ! { dg-final { scan-tree-dump "c = {CLOBBER};" "original" } }
43 ! { dg-final { scan-tree-dump "d = {CLOBBER};" "original" } }
44 ! { dg-final { scan-tree-dump-not "123456789" "optimized" { target __OPTIMIZE__ } } }
45 ! { dg-final { scan-tree-dump-not "987654321" "optimized" { target __OPTIMIZE__ } } }