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++/49165] [4.3/4.4/4.5/4.6/4.7 Regression] ICE on for-loop/throw combination
Date: Thu, 26 May 2011 09:26:00 -0000	[thread overview]
Message-ID: <bug-49165-4-j7FDXcd5ZX@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-49165-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49165

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> 2011-05-26 08:47:36 UTC ---
No.
Both arms shouldn't be VOID_TYPE_P, otherwise the COND_EXPR would be
VOID_TYPE_P too and we really shouldn't be using the COND_EXPR's value.
The problem is that the C++ FE gives us
COND_EXPR with bool type (or some other type), with one arm the same type and
the other arm THROW_EXPR (i.e. VOID_TYPE_P).
The gimplifier is already aware of this and handles it right:
      /* Build the new then clause, `tmp = then_;'.  But don't build the
         assignment if the value is void; in C++ it can be if it's a throw.  */
      if (!VOID_TYPE_P (TREE_TYPE (then_)))
        TREE_OPERAND (expr, 1) = build2 (MODIFY_EXPR, type, tmp, then_);

      /* Similarly, build the new else clause, `tmp = else_;'.  */
      if (!VOID_TYPE_P (TREE_TYPE (else_)))
        TREE_OPERAND (expr, 2) = build2 (MODIFY_EXPR, type, tmp, else_);
just shortcut_cond_r didn't handle it well (it created
COND_EXPR with void type throw ? goto L1 : goto L2).


  parent reply	other threads:[~2011-05-26  8:48 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-25 18:34 [Bug c++/49165] New: " gcc at portuosus dot com
2011-05-25 18:43 ` [Bug c++/49165] " gcc at portuosus dot com
2011-05-25 18:55 ` [Bug c++/49165] [4.3/4.4/4.5/4.6/4.7 Regression] " jakub at gcc dot gnu.org
2011-05-25 19:51 ` jakub at gcc dot gnu.org
2011-05-25 20:30 ` jason at gcc dot gnu.org
2011-05-26  7:48 ` jakub at gcc dot gnu.org
2011-05-26  8:30 ` rguenth at gcc dot gnu.org
2011-05-26  9:26 ` jakub at gcc dot gnu.org [this message]
2011-05-26 10:28 ` jakub at gcc dot gnu.org
2011-05-26 10:34 ` jakub at gcc dot gnu.org
2011-05-26 11:05 ` [Bug c++/49165] [4.3/4.4/4.5 " jakub at gcc dot gnu.org
2011-05-27  8:02 ` gcc at portuosus dot com
2011-05-27 12:31 ` jakub at gcc dot gnu.org
2011-05-27 19:24 ` jakub at gcc dot gnu.org
2011-05-27 19:32 ` jakub at gcc dot gnu.org
2011-05-27 22:31 ` gcc at portuosus dot com
2011-06-27 10:45 ` rguenth at gcc dot gnu.org
2011-06-27 13:51 ` rguenth at gcc dot gnu.org
2011-07-19 12:55 ` [Bug c++/49165] [4.4/4.5 " jakub at gcc dot gnu.org
2011-07-19 12:57 ` jakub at gcc dot gnu.org
2011-07-19 19:31 ` jakub at gcc dot gnu.org
2011-07-19 19:31 ` jakub at gcc dot gnu.org
2011-07-19 19:53 ` jakub 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-49165-4-j7FDXcd5ZX@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: link
Be 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).