Hi,

The following example, when built with -O2, results in 

~$ .gcc -O2 -o test2 ~/test2.c 
/tmp/cc6SGh7Z.s: Assembler messages:
/tmp/cc6SGh7Z.s:16: Error: syntax error; found `,' but expected `('
/tmp/cc6SGh7Z.s:16: Error: junk at end of line: `,0'

This code is extracted from libatomic-ops (see http://bugs.debian.org/432654)
and is causing build failures for some powerpc packages.

4.2.1 and SVN don't fully build on my powerpc64 system (fails comparing objects
between stage2->3) but using the partially built stage3 xgcc the same problem
happens.

Thanks!

--- testcase ---

static inline unsigned long
load_acquire(volatile unsigned long *addr)
{
  unsigned long result;

  __asm__ __volatile__ (
    "lwz %0,%1\n"
    "cmpw cr7,%0,%0\n"
    "bne- cr7,1f\n"
    "1: isync\n"
    : "=r" (result)
    : "m"(*addr) : "memory", "cc");
  return result;
}

int
main(int argc, char **argv) {
  unsigned long *value, i, res;

  res = load_acquire(value + i);

  return 0;
}
--- end ---


-- 
           Summary: GCC outputs invalid assembly when using -O2
           Product: gcc
           Version: 4.2.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: inline-asm
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ianw at gelato dot unsw dot edu dot au
  GCC host triplet: powerpc64-unknown-linux-gnu


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

Reply via email to