https://gcc.gnu.org/bugzilla/show_bug.cgi?id=93621

--- Comment #9 from Martin Jambor <jamborm at gcc dot gnu.org> ---
(In reply to Jan Hubicka from comment #3)
> The testcase builds for me now, but this is Martin's code

that's questionable :-) Git blame points correctly to me but before
new IPA-SRA the assert used to be:

  gcc_assert (!node || !node->clone.combined_args_to_skip);

and was added by Honza in 2012 (in 66a20fc2a7de).

> (apparently
> checking that we did not forget to apply param adjustments)

AFAIU no, quite the opposite, it checks that we are not going to apply
param adjustment twice to a call, which is in a way what we are about
to do.

We find ourselves looking at a call statement with parameters already
adjusted and the decl in the statement being the IPA-CP created one.
In the cgraph edge, however, the callee's decl is one created during
save_inline_function_body.  Because redirect_call_stmt_to_callee
decides whether it has to do anything by comparing decls, it thinks it
has to redirect and remove params and... BOOM.

When I wrote that the call had already been adjusted that actually was
not entirely true.  The call was already created that way in
expand_thunk, because it is in an expanded artificial thunk of the
IPA-CP clone.

The assumption was that because the decl would be the correct one from
the start, no additional redirection would be taking place.  That
perhaps wasn't the best idea as save_inline_function_body can clearly
violate that (and in future some IPA pass might want to redirect the
edge too).

Having said that, I am not sure where to best fix this so late in the
GCC 10 development cycle.

Reply via email to