Diagnostic 15126: vectorization support: unaligned access used inside loop body

Cause:

This diagnostic message appears when a reference variable is used in the code which is not aligned in memory. Below is an example for this scenario:

Example:
 

#include<stdlib.h>
#define N 70
int main(int argc, char 
*argv[]){
int a[N], i;
for(i = 2; i < N; i++)
        a[i] = a[i-2] 
+ 1;
return 0;
}


$ icpc dependency.cc -vec-report6
dependency.cc(7): (col. 2) remark: vectorization support: reference a has unaligned access
dependency.cc(7): (col. 2) remark: vectorization support: reference a has unaligned access
dependency.cc(7): (col. 2) remark: vectorization support: unaligned access used inside loop body
dependency.cc(6): (col. 1) remark: loop was not vectorized: existence of vector dependence
dependency.cc(7): (col. 2) remark: vector dependence: assumed FLOW dependence between a line 7 and a line 7

Recommendation:

Use __declspec(align()) declaration on Windows* and __attribute__((align())) on Linux* while declaring that array or use __aligned_malloc() or __mm_malloc() for dynamically allocated memory.

For more complete information about compiler optimizations, see our Optimization Notice.