From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1563 invoked by alias); 6 Aug 2013 12:06:56 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 1441 invoked by uid 48); 6 Aug 2013 12:06:51 -0000 From: "zajec5 at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/58092] New: BEQ (Branch on equal) jumps to wrong address (executes conditional code!) Date: Tue, 06 Aug 2013 12:06:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: 4.6.4 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: zajec5 at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2013-08/txt/msg00352.txt.bz2 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)