I found a bug when using the inline ASM of Intel Parallel Studio XE 2015 Update 2 Composer Edition for C++ Windows. Since I'm not very familiar with inline ASM, I'm not sure if it is a bug.
#include <iostream> using namespace std; __forceinline void DoNothingWithMemory( float*const copyByValue ) { float* copyByValueAgain = copyByValue ; /* As you see, the two var in this function, "copyByValueAgain" and "copyByValue", are copied by value. Therefore, even if the code block of inline asm below changes one of them, there's nothing to do with the var "p" in the main function. However, the fact is, the var "p" in the main function IS changed after executing the code block of inline asm below! */ __asm__ __volatile__( "lea 4(%0),%0;" //In fact, nothing is done here. It's just a "lea", and has nothing to do with memory or pointer aliasing! : :"r"( copyByValueAgain ) : ); } int main() { float a; //just a place holder float* const p=&a; // As "p" is "const", it's impossible to change and should always point to "&a". for(int i = 0; i < 999; ++i) { cout<<p<<endl; // However, if you take a look at the output of this instruction, you will find that "p" changes every each loop, and that's really weird. DoNothingWithMemory(p); } system("PAUSE"); }