public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "rmerkert at alphatech dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/13239] [3.4 regression] Assertion does not seem to work correctly anymore Date: Tue, 02 Dec 2003 23:40:00 -0000 [thread overview] Message-ID: <20031202234056.21865.qmail@sources.redhat.com> (raw) In-Reply-To: <20031130163447.13239.rmerkert@alphatech.com> ------- Additional Comments From rmerkert at alphatech dot com 2003-12-02 23:40 ------- I think it's the __builtin_expect that does not work. This example is reduced to use of __builtin_expect only and it should be possible to replicate it on any system that uses builtin_expect. The key to this problem is the use the expression "__builtin_expect (... ,1) ? 0 : -1" (replace -1 with any number other than 1) and the example fails. Use 1 and it works! Looks like an optimization problem. #include <cstdio> struct Y { Y () : _y(0) {} //Y (const Y& y) : _y(y._y) {} int _y; }; extern Y bar(); extern bool foo(); int main() { int x = __builtin_expect(foo() && (bar()._y)==0,1) ? 0 : -1; ::std::printf("%d\n",x); return x; } bool foo() { return true; } Y bar() { return Y(); } -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13239
next prev parent reply other threads:[~2003-12-02 23:40 UTC|newest] Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top 2003-11-30 16:34 [Bug c++/13239] New: [3.3 REGRESSION] " rmerkert at alphatech dot com 2003-11-30 17:16 ` [Bug c++/13239] " rmerkert at alphatech dot com 2003-12-01 15:54 ` bangerth at dealii dot org 2003-12-02 3:13 ` rmerkert at alphatech dot com 2003-12-02 3:16 ` rmerkert at alphatech dot com 2003-12-02 22:32 ` rmerkert at alphatech dot com 2003-12-02 23:00 ` bangerth at dealii dot org 2003-12-02 23:38 ` [Bug c++/13239] [3.4 regression] " bangerth at dealii dot org 2003-12-02 23:40 ` rmerkert at alphatech dot com [this message] 2003-12-03 0:04 ` [Bug c++/13239] [3.3/3.4 " bangerth at dealii dot org 2003-12-05 23:09 ` pinskia at gcc dot gnu dot org 2003-12-06 20:59 ` bangerth at dealii dot org 2003-12-10 17:40 ` janis187 at us dot ibm dot com 2003-12-19 14:04 ` cvs-commit at gcc dot gnu dot org 2003-12-19 14:17 ` cvs-commit at gcc dot gnu dot org 2003-12-21 22:45 ` pinskia at gcc dot gnu dot org 2004-01-27 15:29 ` cvs-commit at gcc dot gnu dot org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20031202234056.21865.qmail@sources.redhat.com \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).