This is the mail archive of the gcc@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]
Other format: [Raw text]

Re: asm as "memory barrier"


On Wed, Apr 23, 2003 at 03:55:57PM -0400, Paul Koning wrote:
> But it also (as documented) causes the compiler to assume that memory
> has changed since then, i.e., anything it loaded before is no longer
> valid.  That's NOT what I want.

There doesn't appear to be any way to do this.  I'd have expected

  int x;
  int foo()
  {
    int r = x;
    {
      char *p;
      asm ("" : "=X"(p));
      asm volatile ("" : : "X"(*p));
    }
    return x + r;
  }

to work (as an observed read from a pointer with unknown value),
but it would seem that CSE doesn't want to combine the two loads
across the volatile asm.


r~


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