This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: asm volatile("":::"memory) uncertainty.
- From: Andrew Haley <aph at redhat dot com>
- To: gcc-help at gcc dot gnu dot org
- Date: Mon, 16 May 2016 11:28:50 +0100
- Subject: Re: asm volatile("":::"memory) uncertainty.
- Authentication-results: sourceware.org; auth=none
- References: <f3141159-2f2a-6317-8dd6-da0aa64eca14 at ionoptix dot com> <5731A8BE dot 2090507 at redhat dot com> <2114b82e-9215-6080-f4ba-53cf90f6e428 at ionoptix dot com>
On 16/05/16 04:51, Tom Udale wrote:
> My main fear is that the optimizer will look at the empty assembly ""
> block and say "wait a minute, nothing is happening in there, how can it
> possibly jump"?
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 to remove statements which it
knows have no side effects.
Andrew.