https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93942

            Bug ID: 93942
           Summary: [Extended-Asm] Last code snippet in 6.47.2.3 Output
                    Operands  is unsafe
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: web
          Assignee: unassigned at gcc dot gnu.org
          Reporter: frederic.recou...@univ-grenoble-alpes.fr
  Target Milestone: ---

The following code snippet is wrong because the compiler can choose memory "m"
constraint for both d and *e.

uint32_t c = 1;
uint32_t d;
uint32_t *e = &c;

asm ("mov %[e], %[d]"
   : [d] "=rm" (d)
   : [e] "rm" (*e));

The correct version should use a multi-alternative and it might be a good place
to introduce this notion.

asm ("movl %[e], %[d]"
   : [d] "=r,m" (d)
   : [e] "g,ri" (*e));

Reply via email to