Segmentation fault when trying to use intrinsics specifically _mm256_storeu_pd()
<p>Seemed to have fixed it myself by type casting the cij2 pointer inside the mm256 call</p>

<p>so _mm256_storeu_pd((double *)cij2,vecC);</p>

<p>I have no idea why this changed anything...</p>

<p>I'm writing some code and trying to take advantage of the Intel manual vectorization. But whenever I run the code I get a segmentation fault on trying to use my double *cij2.</p>

<pre><code>if( q == 0)
{
    __m256d vecA;
    __m256d vecB;
    __m256d vecC;
    for (int i = 0; i &lt; M; ++i)
      for (int j = 0; j &lt; N; ++j)
      {
        double cij = C[i+j*lda];
        double *cij2 = (double *)malloc(4*sizeof(double));
        for (int k = 0; k &lt; K; k+=4)
        {
          vecA = _mm256_load_pd(&amp;A[i+k*lda]);
          vecB = _mm256_load_pd(&amp;B[k+j*lda]);
          vecC = _mm256_mul_pd(vecA,vecB);
          _mm256_storeu_pd(cij2, vecC);
          for (int x = 0; x &lt; 4; x++)
          {
            cij += cij2[x];
          }

        }
        C[i+j*lda] = cij;
      }
</code></pre>

<p>I've pinpointed the problem to the cij2 pointer. If i comment out the 2 lines that include that pointer the code runs fine, it doesn't work like it should but it'll actually run. </p>

<p>My question is why would i get a segmentation fault here? I know I've allocated the memory correctly and that the memory is a 256 vector of double's with size 64 bits.</p>

<p>After reading the comments I've come to add some clarification.
First thing I did was change the _mm_malloc to just a normal allocation using malloc. Shouldn't affect either way but will give me some more breathing room theoretically. </p>

<p>Second the problem isn't coming from a null return on the allocation, I added a couple loops in to increment through the array and make sure I could modify the memory without it crashing so I'm relatively sure that isn't the problem. The problem seems to stem from the loading of the data from vecC to the array.</p>

<p>Lastly I can not use BLAS calls. This is for a parallelisms class. I know it would be much simpler to call on something way smarter than I but unfortunately I'll get a 0 if I try that. </p>