Quantcast
Channel: Intel® Software - Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 2797

Apparent IPO compiler bug

$
0
0

I just encountered a very strange compiler (or linker?) bug, thought I should report it here. My description here is what I guess is happening... This is in icl 15.0.2.179 Build 20150121

I use a string - "Stream (via VLC)" - at multiple places. So in one place I used:
strcpy(some_variable, "Stream (via VLC)");

In another I now added:
strstr(some_other_variable, "Stream (via VLC)");

For the strcpy, the compiler sees that it can perform the full strcpy with just 2 SSE instructions (it's a 16 character/byte string). So, it loads the string into an SSE2 register and then stores it. This however requires that the string is aligned on a 16 byte address, and until now it always was.

But now I created that strstr line, which created another copy of this string which didn't have to be 16 byte aligned, and it wasn't.

So far so good. But in a final optimization step, the compiler checks if strings occur multiple times, and if so, it throws all of them away but one. And the one it kept wasn't 16-byte aligned. Which caused the code to crash in release mode (and the cause was only visible by looking at the generated assembly code).

I have a workaround (don't use a string in one of the two places but just set the array values separately), but this is something that could really drive people who don't understand how SSE works and can't read disassembly insane.


Viewing all articles
Browse latest Browse all 2797

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>