public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jason Merrill <jason@redhat.com>
To: Jakub Jelinek <jakub@redhat.com>
Cc: gcc-patches List <gcc-patches@gcc.gnu.org>
Subject: Re: [C++ PATCH] Fix ICE with return in statement expression in constexpr.c (PR c++/84192)
Date: Fri, 16 Feb 2018 13:52:00 -0000	[thread overview]
Message-ID: <CADzB+2=KT3ygZwfS1Hu2k4AJqi94Ezra9xwFf-M9o=94xi1xqg@mail.gmail.com> (raw)
In-Reply-To: <20180216082814.GM5867@tucnak>

On Fri, Feb 16, 2018 at 3:28 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> pop_stmt_list, if there is just a single stmt inside statement expression
> moves the stmt out of the STATEMENT_LIST (and I think cp_fold does too).
> We only initialize jump_target to non-NULL in cxx_eval_statement_list
> or for calls, so before we have a chance to diagnose the error of using
> an expression with void type, we ICE trying to dereference NULL jump_target.
>
> This can't happen with BREAK_STMT nor CONTINUE_STMT, because they are not
> potential constant expressions, and I think can only happen when ctx->quiet
> is true, otherwise it should have been diagnosed already before.
> If a RETURN_EXPR (or in theory break/continue) appears in a (potential) constant
> expression we want to evaluate, not doing anything with jump_target if we
> aren't inside a statement list makes sense to me, there is no following
> statement to bypass.

I think we should also set *non_constant_p.

Jason

  reply	other threads:[~2018-02-16 13:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-16  9:49 Jakub Jelinek
2018-02-16 13:52 ` Jason Merrill [this message]
2018-02-16 18:49   ` Jakub Jelinek
2018-02-16 15:20     ` Jason Merrill

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='CADzB+2=KT3ygZwfS1Hu2k4AJqi94Ezra9xwFf-M9o=94xi1xqg@mail.gmail.com' \
    --to=jason@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jakub@redhat.com \
    /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).