optimization/3921: wrong output with -02 on sparc-sun-solaris2.6) compiled by GNU C version 3.0. /usr/ccs/bin/as -V -using __asm wrong output with -O2 on sparc-sun-solaris2.6

rth@gcc.gnu.org rth@gcc.gnu.org
Tue Apr 2 03:25:00 GMT 2002


Synopsis: wrong output with -02 on sparc-sun-solaris2.6)         compiled by GNU C version 3.0.  /usr/ccs/bin/as -V -using __asm wrong output with -O2 on sparc-sun-solaris2.6

State-Changed-From-To: open->closed
State-Changed-By: rth
State-Changed-When: Tue Apr  2 03:20:03 2002
State-Changed-Why:
    The definition of BAR is incorrect.  The asm modifies memory
    without informing the compiler of this.  Correct behaviour is
    obtained by either adding a clobber of "memory", or by leaving
    most of the actual data movement to gcc.  E.g.
    
    static inline void
    bar(int a, int b, int c, int *z, int *r)
    {
      __asm__("addcc %[A0],%[B1],%[R0]\n\t"
              "addxcc %[A1],%[B1],%[R1]\n\t"
              "addx %[A2],%[B2],%[R2]"
              : [R0] "=&r" (z[0]), [R1] "=&r" (z[1]), [R2] "=r" (r[1])
              : [A0] "r" (z[0]), [B0] "rI" (a),
                [A1] "r" (z[1]), [B1] "rI" (b),
                [A2] "r" (c), [B2] "rI" (0)
              : "cc");
    }

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=3921



More information about the Gcc-bugs mailing list