tree-optimization/113385 - wrong loop father with early exit vectorization
[official-gcc.git] / gcc / testsuite / gfortran.dg / generic_31.f90
blob449ca5e558a9c09b7996c1ef22471dbfd4feb75d
1 ! { dg-do run }
3 ! PR fortran/66929
4 ! Check that the specific FIRST symbol is used for the call to FOO,
5 ! so that the J argument is not assumed to be present
7 module m
8 interface foo
9 module procedure first
10 end interface foo
11 contains
12 elemental function bar(j) result(r)
13 integer, intent(in), optional :: j
14 integer :: r, s(2)
15 ! We used to have NULL dereference here, in case of a missing J argument
16 s = foo(j, [3, 7])
17 r = sum(s)
18 end function bar
19 elemental function first(i, j) result(r)
20 integer, intent(in), optional :: i
21 integer, intent(in) :: j
22 integer :: r
23 if (present(i)) then
24 r = i
25 else
26 r = -5
27 end if
28 end function first
29 end module m
30 program p
31 use m
32 integer :: i
33 i = bar()
34 if (i /= -10) STOP 1
35 end program p