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 22.214.171.124 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.
If you could please create a small test cases which shows the problem along with the command line options you are using we can check to see if it's fixed and if not enter a defect report.
Much appreciated... thanks!
Have you verified the issue with latest compiler 17.0? The 15.0 compiler is kind old. It there's no strong reason, we won't fix the issue in an old version, rather on the latest version.
Sorry for not responding sooner. This is not really an urgent issue, and I don't have time to make a test case for it (I just worked around it by not using a strncpy in one of the places where I used it). I don't have the latest compiler so I can't check that either. Just wanted to let you know that this bug seems to be present, it could very well be that it's already fixed indeed. If it's still there, it can lead to very odd bugs, which someone who doesn't know that SSE and AVX require aligned data and that the compiler can combine strings will probably not be able to figure out on their own.