Quantcast
Channel: Intel® Fortran Compiler for Linux* and macOS*
Viewing all articles
Browse latest Browse all 2583

Optimisation Past Subroutine Calls

$
0
0

Hi All,

This might be a silly question, but I can't seem to decide on the answer myself. Is a compiler allowed to optimise past a call to a subroutine? For example, consider this:

subroutine sub ( l, r )
  real(8), intent(inout) :: l(*), r(*)
  l(2) = 2.0_8
  call other_sub(l(1), r(1))
  l(2) = r(2)
end subroutine sub

Is the compiler allowed to remove the first assignment, since other_sub is called with only the first elements of the arrays?

I'm most considering the case when there's no interface for other_sub. I often see calls like this for MPI calls in some of our old code, passing the first element of an array section as the buffer with a non-unit buffer size. I'm worried this might eventually break things if extra optimisations are used.

Cheers,

Ben


Viewing all articles
Browse latest Browse all 2583

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>