http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58092
Bug ID: 58092 Summary: BEQ (Branch on equal) jumps to wrong address (executes conditional code!) Product: gcc Version: 4.6.4 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: zajec5 at gmail dot com Created attachment 30617 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30617&action=edit Minimal test case (ANSI C) In my code I'm using simple if (rev == 0x4) to make a conditional write. Unfortunately when using mipsel gcc with "-Os" the code from conditional part is *partially* executed even when "rev" doesn't equal 4. > mipsel-openwrt-linux-uclibc-gcc -v Reading specs from /home/zajec/openwrt/openwrt.git/staging_dir/toolchain-mipsel_gcc-4.6-linaro_uClibc-0.9.33.2/lib64/gcc/mipsel-openwrt-linux-uclibc/4.6.4/specs COLLECT_GCC=mipsel-openwrt-linux-uclibc-gcc COLLECT_LTO_WRAPPER=/home/zajec/openwrt/openwrt.git/staging_dir/toolchain-mipsel_gcc-4.6-linaro_uClibc-0.9.33.2/lib/gcc/mipsel-openwrt-linux-uclibc/4.6.4/lto-wrapper Target: mipsel-openwrt-linux-uclibc Configured with: /home/zajec/openwrt/openwrt.git/build_dir/toolchain-mipsel_gcc-4.6-linaro_uClibc-0.9.33.2/gcc-linaro-4.6-2012.12/configure --with-bugurl=https://dev.openwrt.org/ --with-pkgversion='OpenWrt/Linaro GCC 4.6-2012.12 r36315' --prefix=/home/zajec/openwrt/openwrt.git/staging_dir/toolchain-mipsel_gcc-4.6-linaro_uClibc-0.9.33.2 --build=x86_64-suse-linux --host=x86_64-suse-linux --target=mipsel-openwrt-linux-uclibc --with-gnu-ld --enable-target-optspace --disable-libgomp --disable-libmudflap --disable-multilib --disable-nls --with-host-libstdcxx=-lstdc++ --with-float=soft --with-gmp=/home/zajec/openwrt/openwrt.git/staging_dir/host --with-mpfr=/home/zajec/openwrt/openwrt.git/staging_dir/host --disable-decimal-float --with-mips-plt --with-mpc=/home/zajec/openwrt/openwrt.git/staging_dir/host --disable-libssp --disable-__cxa_atexit --with-headers=/home/zajec/openwrt/openwrt.git/staging_dir/toolchain-mipsel_gcc-4.6-linaro_uClibc-0.9.33.2/include --enable-languages=c,c++ --enable-shared --enable-threads --with-slibdir=/home/zajec/openwrt/openwrt.git/staging_dir/toolchain-mipsel_gcc-4.6-linaro_uClibc-0.9.33.2/lib --enable-lto --with-libelf=/home/zajec/openwrt/openwrt.git/staging_dir/host Thread model: posix gcc version 4.6.4 (OpenWrt/Linaro GCC 4.6-2012.12 r36315)