1! { dg-do run } 2! 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 6 7module m 8 interface foo 9 module procedure first 10 end interface foo 11contains 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 29end module m 30program p 31 use m 32 integer :: i 33 i = bar() 34 if (i /= -10) STOP 1 35end program p 36