Note: This comment is full of mistakes, that I didn’t even bother correcting it. Please read on for the correct understanding.
So I would like to paraphrase the docs and specialize on the above example, correct me if I am wrong.
It seems that
@boundscheck, which should ideally surround only bound checking lines, communicates with the function calling
assemble! only if
assemble! was inlined and the function call was in an
@inbounds block, telling it (or the compiler really) to skip the lines in the
@propagate_inbounds looks for
@boundscheck blocks in one deeper layer of function calls, skipping any lines in the
So it is useless to do the following:
@propagate_inbounds if no
@inbounds block exists in the function. This one is pretty obvious.
@boundscheck block in a function when the function is not inlined and directly called in an
@inbounds block in the caller function, or is indirectly called in an
@inbounds block in a function (any number of function calls down the stack) decorated with