This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: C++ PATCH for c++/84978, ICE with NRVO


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]