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

            Bug ID: 60454
           Summary: Code mistakenly detected as doing bswap
           Product: gcc
           Version: 4.9.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: thomas.preudhomme at arm dot com

Created attachment 32296
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32296&action=edit
Testcase for bswap incorrect detection

Optimization pass optimize_bswap in tree-ssa-math-opts.c incorrectly detect a
bswap being performed in certain cases, leading to wrong code being generated.

Please find attached a testcase that exhibit the problem. Compile with trunk
gcc with gcc -O2 -fdump-tree-bswap -c testcase.c and observe that
testcase.c.*bswap contains the string "32 bit bswap implementation found at"
while the code does not perform a byte swap. This test was tried on an Ubuntu
"13.10 (saucy) with 4.8.1 and trunk gcc.

gcc 4.8.1 was configured with:

../src/configure -v --with-pkgversion='Ubuntu/Linaro 4.8.1-10ubuntu9'
--with-bugurl=file:///usr/share/doc/gcc-4.8/README.Bugs
--enable-languages=c,c++,java,go,d,fortran,objc,obj-c++ --prefix=/usr
--program-suffix=-4.8 --enable-shared --enable-linker-build-id
--libexecdir=/usr/lib --without-included-gettext --enable-threads=posix
--with-gxx-include-dir=/usr/include/c++/4.8 --libdir=/usr/lib --enable-nls
--with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug
--enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin
--with-system-zlib --disable-browser-plugin --enable-java-awt=gtk
--enable-gtk-cairo --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64/jre
--enable-java-home --with-jvm-root-dir=/usr/lib/jvm/java-1.5.0-gcj-4.8-amd64
--with-jvm-jar-dir=/usr/lib/jvm-exports/java-1.5.0-gcj-4.8-amd64
--with-arch-directory=amd64 --with-ecj-jar=/usr/share/java/eclipse-ecj.jar
--enable-objc-gc --enable-multiarch --disable-werror --with-arch-32=i686
--with-abi=m64 --with-multilib-list=m32,m64,mx32 --with-tune=generic
--enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu
--target=x86_64-linux-gnu

while trunk gcc was configured with:

../src/configure --prefix=../install --target=arm-none-eabi
--enable-languages=c,c++ --with-mode=thumb --with-cpu=cortex-m3 --with-newlib
--with-headers=../src/newlib/libc/include --enable-newlib-register-fini
--disable-newlib-supplied-syscalls --disable-multilib --with-libexpat
--with-system-zlib --disable-gdbtk --enable-plugins --disable-libgomp
--disable-libmudflap --disable-libquadmath --disable-libssp
--disable-libstdcxx-pch --disable-nls --disable-rda --disable-sid --disable-tui
--disable-utils --disable-werror --disable-fixed-point

I'm currently cleaning a patch to solve this issue.

Best regards.

Reply via email to