asm volatile("":::"memory) uncertainty.

Andrew Haley aph@redhat.com
Tue May 17 08:47:00 GMT 2016


On 05/17/2016 12:40 AM, Tom Udale wrote:
> Hi Andrew,
> 
>  > It won't: GCC does not inspect asms to see if they do
>  > anything. Besides, if you are really worried about that
>  > you can put a "do nothing" comment into the asm.
>  >
>  > I think your reasoning about asm goto is sound.  The
>  > only real problem you'll have is that GCC will
>  > remove statements which it knows have no side effects.
> 
> Do you mean the asm statement itself?  Will the volatile not prevent 
> that?

No, it's just that you must make sure that whatever you are
timing actually does something.

Andrew.




More information about the Gcc-help mailing list