I heard about compiler optimizations.
For example the one when:
while(myBool)
    doStuff();
compiler knows you do not modify myBool inside a while loop, it just read myBool once and doesn't check it every time.
This can be affected by volatile keyword right?
So I have tried to "trick" compiler, it thinks value was not changed.
int main()
{
    struct st 
    {
        int a;
        int b; //I want to make difference by writing volatile here
    }s;
    s.b = 1;
    while(s.b > 0)
    {
        *((&s.a)+1) = 0;
        std::cout << "test" << std::endl;
    }
}
But even with full optimizations turned on (vs2012), this does not trick the compiler. This is probably very lame trick :)
How can I trick it? Is it even possible?
My goal is to create simple single-threaded program, which prints "test" with volatile keyword used and prints infinite-times "test" without the keyword.  
EDIT: Unfortunately I am not good with assembler, so I really can not read if the memory reading was optimized out in the first place :)
 
     
     
     
    