This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: mips64 target erroneously reorders "asm"


>>>>> "Ian" == Ian Lance Taylor <ian@cygnus.com> writes:

 Ian> Date: Fri, 3 Oct 1997 15:50:24 -0400 From: Paul Koning
 Ian> <pkoning@xedia.com>

 Ian> I have some code that, in a nutshell, does the following:

 Ian> asm("foo"); <some operations on volatile data> asm("bar");

 Ian> The resulting mips code has the "asm" operations reordered with
 Ian> respect to the volatile data operations they enclose.  Clearly
 Ian> this is not correct, and, for example, the sparc-solaris2.4
 Ian> target (which is my host) does it right.

 Ian> What happens if you use asm volatile?  asm volatile ("foo");

ARGH.

That fixes the problem.

I tried "volatile" in EVERY other place I could imagine, but not that
one, and that's the only one that helps.  (For example, I had wrapped
the "asm" in a void inline foo(void) volatile function, no luck.)

It doesn't help that the books I have don't list "asm volatile" as a
construct (for example, Stroustrup doesn't show it).  It's a natural
enough construct, of course.  Some mention in documentation would be
helpful if there is some good place for it...

Thanks for the help!


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]