This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ PATCH] Fix ICE with return in statement expression in constexpr.c (PR c++/84192)
- From: Jason Merrill <jason at redhat dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: gcc-patches List <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 16 Feb 2018 08:52:10 -0500
- Subject: Re: [C++ PATCH] Fix ICE with return in statement expression in constexpr.c (PR c++/84192)
- Authentication-results: sourceware.org; auth=none
- References: <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