Bug with PPC 32-bit inline assembler [4.1.1 and 4.3.2]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I ran into a bug with the PPC side of things with both 4.1.1 [came with FC5] and a freshly built 4.3.2, the snippet is this block

#if 0

#define SQRADDSC(i, j)            \
asm(                              \
  " mullw  %0,%6,%7        \n\t" \
  " mulhwu %1,%6,%7        \n\t" \
  " xor    %2,%2,%2        \n\t" \
:"=r"(sc0), "=r"(sc1), "=r"(sc2):"0"(sc0), "1"(sc1), "2"(sc2), "r"(i),"r"(j) : "%cc");

#else

#define SQRADDSC(i, j)            \
asm(                              \
  " mullw  %0,%3,%4        \n\t" \
  " mulhwu %1,%3,%4        \n\t" \
  " xor    %2,%2,%2        \n\t" \
:"=r"(sc0), "=r"(sc1), "=r"(sc2): "r"(i),"r"(j) : "%cc");

#endif

Where {sc0,sc1,sc2} are not previously initialized. The first block (that is disabled) is my old code. It would correctly warn about uninitialized variables. The 2nd block was my fix which to me seems correct. However, the compiler generates output like this

# 0 "" 2
# 38 "fp_sqr_comba_6.i" 1
mullw 25,25,18 mulhwu 9,25,18 xor 0,0,0 Where r25 is both an input and output it seems. Clearly r25 is not supposed to be overwritten here.

I put together a tarball of the source, cmdline, uname, gcc version, etc up at

http://home.libtom.org/gcc/gccbug.tgz

The tarball has all that you need to reproduce the bug with both 4.1.1 and 4.3.2.

Has this been seen before, and/or should I file a gcc bug about it? I guess more importantly, is my PPC "fix" correct?

Thanks,
Tom

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux