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

--- Comment #9 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Jan Hubicka from comment #8)
> I think the ipa-cp summaries should be used only when types match. At least
> Martin added type streaming for all the jump functions.  So we are missing
> some check?

I don't think this applies here, we're having


foo (&b[5]);

with b being int vs int[], so it's not about the argument types matching
or the type of the JF but instead the value effectively changing during
streaming due to varpool node "merging".

As said elsewhere we avoid the issue by preserving the type of possibly
merged decls by wrapping it with a MEM_REF (for rvalues a V_C_E would
be possible as well).  And we unwrap it later when possible (but that's
of course optional).

I think any summary streaming referencing decls subject to WPA merging
need to do the same - it's not possible to recover after the fact since
the original type is lost (for the ARRAY_REF case it might be possible
to infer a type that would be good enough of course).

Reply via email to