PR target/83368
[official-gcc.git] / gcc / testsuite / gfortran.dg / missing_optional_dummy_6.f90
blob8c2ea6a8a89d9b9d54418edd2aa50e0e5249a933
1 ! { dg-do run }
2 ! { dg-options "-fdump-tree-original" }
4 ! PR fortran/41907
6 program test
7 implicit none
8 call scalar1 ()
9 call assumed_shape1 ()
10 call explicit_shape1 ()
11 contains
13 ! Calling functions
14 subroutine scalar1 (slr1)
15 integer, optional :: slr1
16 call scalar2 (slr1)
17 end subroutine scalar1
19 subroutine assumed_shape1 (as1)
20 integer, dimension(:), optional :: as1
21 call assumed_shape2 (as1)
22 call explicit_shape2 (as1)
23 end subroutine assumed_shape1
25 subroutine explicit_shape1 (es1)
26 integer, dimension(5), optional :: es1
27 call assumed_shape2 (es1)
28 call explicit_shape2 (es1)
29 end subroutine explicit_shape1
32 ! Called functions
33 subroutine assumed_shape2 (as2)
34 integer, dimension(:),optional :: as2
35 if (present (as2)) call abort()
36 end subroutine assumed_shape2
38 subroutine explicit_shape2 (es2)
39 integer, dimension(5),optional :: es2
40 if (present (es2)) call abort()
41 end subroutine explicit_shape2
43 subroutine scalar2 (slr2)
44 integer, optional :: slr2
45 if (present (slr2)) call abort()
46 end subroutine scalar2
48 end program test
50 ! { dg-final { scan-tree-dump-times "scalar2 \\(slr1" 1 "original" } }
52 ! { dg-final { scan-tree-dump-times "= es1 != 0B" 1 "original" } }
53 ! { dg-final { scan-tree-dump-times "assumed_shape2 \\(es1" 0 "original" } }
54 ! { dg-final { scan-tree-dump-times "explicit_shape2 \\(es1" 1 "original" } }
56 ! { dg-final { scan-tree-dump-times "= as1 != 0B" 2 "original" } }
57 ! { dg-final { scan-tree-dump-times "assumed_shape2 \\(as1" 0 "original" } }
58 ! { dg-final { scan-tree-dump-times "explicit_shape2 \\(as1" 0 "original" } }