How to avoid code elimination

Oleg Endo oleg.endo@t-online.de
Sun Nov 26 13:19:00 GMT 2017


On Sun, 2017-11-26 at 12:08 +0100, phi gcc wrote:
> .
> .
> if(cond)
> { e=e;
> }
> .
> ....
> 
> I tried to compile with -O0 but to no joy gcc always remove my 'NOP'
> intruction knowing better than me what I could do with it.
> 
> Is there any other idioms I should use, may be an asm("nop") or the
> like I guess ?

Try declaring e "volatile".

Cheers,
Oleg



More information about the Gcc-help mailing list