https://gcc.gnu.org/bugzilla/show_bug.cgi?id=63231
Bug ID: 63231 Summary: value stored in register %eax overwritten by temporary value stored in same register Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target Assignee: unassigned at gcc dot gnu.org Reporter: h.vandierendonck at qub dot ac.uk Created attachment 33475 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=33475&action=edit C++ source exposing bug Erroneous code is generated for the attached test program as a value is moved into %eax, but %eax is subsequently overwritten with a shorter-lived temporary. This error was observer when compiling for the k1om target (Intel MIC / Xeon Phi). Apologies if I am addressing the wrong crowd. The error occurs at optimisation level -O0, but not at higher optimisation levels: # /opt/mpss/3.2.1/sysroots/x86_64-mpsssdk-linux/usr/libexec/k1om-mpss-linux/gcc/k1om-mpss-linux/4.7.0/gcc -O0 -S -o sdi.S sdi.c # gcc -v: Using built-in specs. COLLECT_GCC=/opt/mpss/3.2.1/sysroots/x86_64-mpsssdk-linux/usr/libexec/k1om-mpss-linux/gcc/k1om-mpss-linux/4.7.0/gcc COLLECT_LTO_WRAPPER=/opt/mpss/3.2.1/sysroots/x86_64-mpsssdk-linux/usr/libexec/k1om-mpss-linux/gcc/k1om-mpss-linux/4.7.0/lto-wrapper Target: k1om-mpss-linux Configured with: /sandbox/build/tmp/tmp/work/x86_64-nativesdk-mpsssdk-linux/gcc-cross-canadian-k1om-4.7.0+mpss3.2.1-1/gcc-4.7.0+mpss3.2.1/configure --build=x86_64-linux --host=x86_64-mpsssdk-linux --target=k1om-mpss-linux --prefix=/opt/mpss/3.2.1/sysroots/x86_64-mpsssdk-linux/usr --exec_prefix=/opt/mpss/3.2.1/sysroots/x86_64-mpsssdk-linux/usr --bindir=/opt/mpss/3.2.1/sysroots/x86_64-mpsssdk-linux/usr/bin/k1om-mpss-linux --sbindir=/opt/mpss/3.2.1/sysroots/x86_64-mpsssdk-linux/usr/bin/k1om-mpss-linux --libexecdir=/opt/mpss/3.2.1/sysroots/x86_64-mpsssdk-linux/usr/libexec/k1om-mpss-linux --datadir=/opt/mpss/3.2.1/sysroots/x86_64-mpsssdk-linux/usr/share --sysconfdir=/opt/mpss/3.2.1/sysroots/x86_64-mpsssdk-linux/etc --sharedstatedir=/opt/mpss/3.2.1/sysroots/x86_64-mpsssdk-linux/com --localstatedir=/opt/mpss/3.2.1/sysroots/x86_64-mpsssdk-linux/var --libdir=/opt/mpss/3.2.1/sysroots/x86_64-mpsssdk-linux/usr/lib/k1om-mpss-linux --includedir=/opt/mpss/3.2.1/sysroots/x86_64-mpsssdk-linux/usr/include --oldincludedir=/opt/mpss/3.2.1/sysroots/x86_64-mpsssdk-linux/usr/include --infodir=/opt/mpss/3.2.1/sysroots/x86_64-mpsssdk-linux/usr/share/info --mandir=/opt/mpss/3.2.1/sysroots/x86_64-mpsssdk-linux/usr/share/man --disable-silent-rules --disable-dependency-tracking --with-libtool-sysroot=/sandbox/build/tmp/tmp/sysroots/x86_64-nativesdk-mpsssdk-linux --with-gnu-ld --enable-shared --enable-languages=c,c++ --enable-threads=posix --disable-multilib --enable-c99 --enable-long-long --enable-symvers=gnu --enable-libstdcxx-pch --program-prefix=k1om-mpss-linux- --enable-target-optspace --enable-lto --enable-libssp --disable-bootstrap --disable-libgomp --disable-libmudflap --with-system-zlib --with-linker-hash-style=gnu --enable-cheaders=c_global --with-local-prefix=/opt/mpss/3.2.1/sysroots/k1om-mpss-linux/usr --with-gxx-include-dir=/opt/mpss/3.2.1/sysroots/k1om-mpss-linux/usr/include/c++ --with-build-time-tools=/sandbox/build/tmp/tmp/sysroots/x86_64-linux/usr/k1om-mpss-linux/bin --with-sysroot=/opt/mpss/3.2.1/sysroots/k1om-mpss-linux --with-build-sysroot=/sandbox/build/tmp/tmp/sysroots/knightscorner --disable-libunwind-exceptions --disable-libssp --disable-libgomp --disable-libmudflap --with-mpfr=/sandbox/build/tmp/tmp/sysroots/x86_64-nativesdk-mpsssdk-linux --with-mpc=/sandbox/build/tmp/tmp/sysroots/x86_64-nativesdk-mpsssdk-linux --enable-nls --enable-__cxa_atexit Thread model: posix gcc version 4.7.0 20110509 (experimental) (GCC)