On Tue, Oct 17, 2017 at 12:49:57PM +0200, David Brown wrote: > On 17/10/17 10:12, Segher Boessenkool wrote: > I don't have a build of trunk gcc conveniently available (I am building > a gcc 7 at the moment). If this is a bug, then perhaps it is fixed > since the latest version I tried (6.3.0). It is quite easy to test > there using the marvellous godbolt online compiler: While godbolt is a very nice tool for exploring code generation by various compilers, it is not handy at all for debugging GCC bugs (if you manage to do that at all with it). > The gcc documentation specifically says that asm volatile statements > /can/ be moved. It just does not make it clear what kind of movements > are allowed. It doesn't have to. It is just warning you not to assume it will not move code here. Anything that is not disallowed is allowed. > Is the patch below something you added to the trunk to fix this, or is > it something the trunk already had? Neither. I tested it on GCC 5; it should still apply to trunk as well, since the code there hasn't changed as far as I see. Segher