------- Comment #2 from jakub at gcc dot gnu dot org  2010-06-10 09:44 -------
struct T { unsigned long p; };
struct S { T a, b, c; unsigned d; };

__attribute__((noinline))
void
bar (const T &x, const T &y)
{
  if (x.p != 0x2348 || y.p != 0x2346)
    __builtin_abort ();
}

__attribute__((noinline))
void
foo (S &s, T e)
{
  unsigned long a = e.p;
  unsigned long b = s.b.p;
  __asm__ volatile ("" : : "rm" (a), "rm" (b));
  bar (e, s.b);
}

int
main ()
{
  S s = { { 0x2345 }, { 0x2346 }, { 0x2347 }, 6 };
  T t = { 0x2348 };
  foo (s, t);
}

Updated testcase, this one I believe (don't have a ppc64 around to runtest it)
should crash at runtime.
If PRE_INC/PRE_MODIFY is allowed in asm operands with "m" constraint, then "m"
couldn't be actually ever safely used in inline asm, at least on ppc64.
(mem:DI (plus:DI (reg:DI 4) (const_int 8))) is printed as 8(4) identically to
what (mem:DI (pre_inc:DI (reg:DI 4))) prints - 8(4).  How could the asm find
out which one it is?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=44492

Reply via email to