http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56087
Bug #: 56087 Summary: [m68k] gcc miscompiles pari (multiplication) Classification: Unclassified Product: gcc Version: 4.6.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassig...@gcc.gnu.org ReportedBy: t...@mirbsd.org Created attachment 29257 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29257 preprocessed reduced testcase More context: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=698380 This turned out to be a miscompilation of one function; reduced testcase (still pretty large due to header inclusion, but, oh my) attached. Using the same register twice in muls.l is not permitted. Removing -funroll-loops lets this use two distinct ones, as do control flow differences. This happens on native compilation but can be reproduced on cross compilation. tg@freewrt:~ $ m68k-linux-gnu-gcc -c -g -O3 -funroll-loops -S -o testcase.S testcase.i && fgrep muls testcase.S muls.l #954437177,%d2:%d2 tg@freewrt:~ $ m68k-linux-gnu-gcc -v Using built-in specs. COLLECT_GCC=m68k-linux-gnu-gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/m68k-linux-gnu/4.6/lto-wrapper Target: m68k-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 4.6.3-15' --with-bugurl=file:///usr/share/doc/gcc-4.6/README.Bugs --enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.6 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/m68k-linux-gnu/include/c++/4.6.3 --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --disable-libssp --enable-plugin --enable-objc-gc --disable-werror --disable-multilib --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=m68k-linux-gnu --program-prefix=m68k-linux-gnu- --includedir=/usr/m68k-linux-gnu/include --with-headers=/usr/m68k-linux-gnu/include --with-libs=/usr/m68k-linux-gnu/lib Thread model: posix gcc version 4.6.3 (Debian 4.6.3-15)