[Bug fortran/64118] Strange warning about unused function/subroutine

angelo.graziosi at alice dot it gcc-bugzilla@gcc.gnu.org
Wed Apr 8 13:57:00 GMT 2015


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64118

--- Comment #2 from Angelo Graziosi <angelo.graziosi at alice dot it> ---
In my original test case, if I move the definition of function f(x) before the
subroutine foo(), does not produce warnings. In other words:

  real(dp) function f(x) result(y)
    real(dp), intent(in) :: x
    y = sin(x)
  end function f
  subroutine foo()
    use integrals, only: simpson

    print *, simpson(f, 0.0_dp, 2.0_dp)
    print *, simpson(f, 0.0_dp, 4.0_dp)
  end subroutine foo

DOES NOT produce warnings. Instead:

  subroutine foo()
    use integrals, only: simpson

    print *, simpson(f, 0.0_dp, 2.0_dp)
    print *, simpson(f, 0.0_dp, 4.0_dp)
  end subroutine foo

  real(dp) function f(x) result(y)
    real(dp), intent(in) :: x
    y = sin(x)
  end function f


DORES PRODUCE warnings!

Ciao,
 Angelo.



More information about the Gcc-bugs mailing list