This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C++ PATCH for c++/84978, ICE with NRVO
- From: Jason Merrill <jason at redhat dot com>
- To: Marek Polacek <polacek at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 20 Mar 2018 11:55:36 -0400
- Subject: Re: C++ PATCH for c++/84978, ICE with NRVO
- References: <20180320133205.GE3522@redhat.com>
On Tue, Mar 20, 2018 at 9:32 AM, Marek Polacek <polacek@redhat.com> wrote:
> We started crashing on this test with r258592 which added cp_get_callee_fndecl
> in <case AGGR_INIT_EXPR> in cp_genericize_r.
>
> This ICE apparently depends on whether we perform NRVO or not. If the size of
> S is <=16B we pass it in registers and it compiles fine. But if the size of S
> is >16B, then we pass in memory, and we NRV-optimize. That means that
> s.fn ();
> is turned by finalize_nrv into
> <retval>.fn ();
>
> Then the newly added call to cp_get_callee_fndecl calls maybe_constant_init,
Oops, I forgot that cp_get_callee_fndecl would call
maybe_constant_init, I was just using it to handle both CALL_EXPR and
AGGR_INIT_EXPR. And in fact it looks like we don't really want that
for the other users, either. I think I'll remove it.
> 2018-03-20 Marek Polacek <polacek@redhat.com>
>
> PR c++/84978
> * constexpr.c (cxx_eval_constant_expression): Handle the case when
> a RESULT_DECL isn't in the hash map.
But your patch is also good. OK.
Jason