asm volatile statement reordering

Jeffrey Walton noloader@gmail.com
Tue Oct 17 07:32:00 GMT 2017


On Tue, Oct 17, 2017 at 3:17 AM, David Brown <david@westcontrol.com> wrote:
> ...
> If gcc cannot guarantee this, then pretty much every OS and every
> embedded system programmed using gcc works by luck rather than design.
> Sequences like the one in my link are very common, deep down in many
> systems.

Right, but its not GCC's fault. Using volatile and hoping that things
works as expected has always been held together with duct tape and a
prayer. Also see Ian Lance Taylor's
https://www.airs.com/blog/archives/154.

GCC guesses wrong on occasion. It will remove code that has value that
but does not produce an output because the language does not allow us
to express it.

The C language lacks what we need to express what we need to do. Its a
failure of the C (and C++) committees. Its not a GCC failure.

Jeff



More information about the Gcc-help mailing list