Note that there are some explanatory texts on larger screens.

plurals
  1. POSSE access violation
    text
    copied!<p>I have the code:</p> <pre><code>float *mu_x_ptr; __m128 *tmp; __m128 *mm_mu_x; mu_x_ptr = _aligned_malloc(4*sizeof(float), 16); mm_mu_x = (__m128*) mu_x_ptr; for(row = 0; row &lt; ker_size; row++) { tmp = (__m128*) &amp;original[row*width + col]; *mm_mu_x = _mm_add_ps(*tmp, *mm_mu_x); } </code></pre> <p>From this I get:</p> <pre><code>First-chance exception at 0x00ad192e in SSIM.exe: 0xC0000005: Access violation reading location 0x00000000. Unhandled exception at 0x00ad192e in SSIM.exe: 0xC0000005: Access violation reading location 0x00000000. The program '[4452] SSIM.exe: Native' has exited with code -1073741819 (0xc0000005) </code></pre> <p>when running the program, the error occurs at the _mm_add_ps line. </p> <p>original is allocated using _aligned_malloc(..., 16); as well and passed to the function, so it shouldn't, as far as my understanding of sse goes, be that it's not alligned.</p> <p>I'm wondering if anyone can see why this crashes, since I can't see why.</p> <p>EDIT: Width and col is always multiples of 4. Col is 0 or 4, while width is always a multiple of 4.</p> <p>EDIT2: Looks like my original array is not aligned. Wouldn't:</p> <pre><code>function(float *original); . . . orignal = _aligned_malloc(width*height*sizeof(float), 16); function(original); _aligned_free(original); } </code></pre> <p>Make sure that original is alligned inside of function?</p> <p>Edit3: This is actually really weird. When I do:</p> <pre><code>float *orig; orig = _aligned_malloc(width*height*sizeof(float), 16); assert(isAligned(orig)); </code></pre> <p>The assert fails with</p> <pre><code>#define isAligned(p) (((unsigned long)(p)) &amp; 15 == 0) </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload