real function foo(i, y) implicit none (type, external) interface subroutine print_i(i); integer, intent(in) :: i; end subroutine bar(); end end interface integer :: i real :: y foo = 0.0 call print_i(i) i = 5 call bar() ! < this prevents optimizing the sin(y) away if (i == 5) return foo = sin(y) end