Effect of `contiguous` attribute for dummy array arguments

From my experience, it does when -O3 is set (perhaps other heuristics also come into play). With -fopt-info the optimizer emits a message like:

/app/example.f90:4:15: optimized: versioned this loop for when certain strides are 1

I posted an example here: What's the purpose of array size inside subroutine arguments? - #8 by ivanpribec

It goes without saying that machine architecture-specific optimizations need to be enabled too, -march=..., for vectorization to come into play.

2 Likes