public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/56481] [4.8 Regression] endless loop compiling a C++ file Date: Thu, 28 Feb 2013 12:00:00 -0000 [thread overview] Message-ID: <bug-56481-4-q21IdroeP2@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-56481-4@http.gcc.gnu.org/bugzilla/> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56481 Jakub Jelinek <jakub at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2013-02-28 CC| |jakub at gcc dot gnu.org, | |jason at gcc dot gnu.org Target Milestone|--- |4.8.0 Ever Confirmed|0 |1 --- Comment #1 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-02-28 11:59:57 UTC --- Reduced testcase: struct S { bool foo () const; #define A(n) , f##n##0, f##n##1, f##n##2, f##n##3 #define B(n) A(n##0) A(n##1) A(n##2) A(n##3) #define C B(0) B(1) B(2) B(3) bool f C; }; bool S::foo () const { #undef A #define A(n) && f##n##0 && f##n##1 && f##n##2 && f##n##3 const bool ret = f C; return ret; } Started with my http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=192862 It actually isn't endless, just the compile time complexity is bad. The problem is I think in: if (!potential_constant_expression_1 (op, rval, flags)) return false; if (!processing_template_decl) op = maybe_constant_value (op); in TRUTH_{AND,OR}*_EXPR handling in potential_constant_expression_1, because maybe_constant_value calls potential_constant_expression (op) again. They are called with different second/third argument (false, tf_none inside maybe_constant_value, or true (== rval), flags above) though, so I think the fix wouldn't be as easy as inlining maybe_constant_value by hand here and avoiding the potential_constant_expression there. Jason, any ideas? For large && or || expressions perhaps we could just handle the cases where op is the same code specially, still we wouldn't get rid of the large complexity if say TRUTH_AND*_EXPR is only in every second code and there is some other code in between.
next prev parent reply other threads:[~2013-02-28 12:00 UTC|newest] Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top 2013-02-28 10:32 [Bug c++/56481] New: " doko at gcc dot gnu.org 2013-02-28 12:00 ` jakub at gcc dot gnu.org [this message] 2013-02-28 16:58 ` [Bug c++/56481] " jason at gcc dot gnu.org 2013-02-28 17:36 ` jakub at gcc dot gnu.org 2013-02-28 20:22 ` jason at gcc dot gnu.org 2013-02-28 20:37 ` jason at gcc dot gnu.org 2013-02-28 20:45 ` jakub at gcc dot gnu.org 2013-03-17 2:38 ` jason at gcc dot gnu.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=bug-56481-4-q21IdroeP2@http.gcc.gnu.org/bugzilla/ \ --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).