https://gcc.gnu.org/bugzilla/show_bug.cgi?id=67133
Martin Jambor <jamborm at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hubicka at gcc dot gnu.org --- Comment #20 from Martin Jambor <jamborm at gcc dot gnu.org> --- The problem is that when inlining transformation sets fndecl of the call statement, it does not set the fntype (of the statement). Then infer_nonnull_range_by_attribute comes along, looks only at the fntype and infers that the call has more attributes than it actually has. The following (untested) patch avoids the ICE. Even though this issue suggests that the type of fndecl and fntype have to be in sync, I have vague recollections that call statement's fntype was supposed to stick to the original type in the source somehow (though IIRC it is primarily used for indirect calls). In other words, I am not sure the patch is 100% correct. Honza, Richi, what are your opinions? diff --git a/gcc/cgraph.c b/gcc/cgraph.c index 22a9852..5e5b308 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -1461,6 +1461,7 @@ cgraph_edge::redirect_call_stmt_to_callee (void) { new_stmt = e->call_stmt; gimple_call_set_fndecl (new_stmt, e->callee->decl); + gimple_call_set_fntype (new_stmt, TREE_TYPE (e->callee->decl)); update_stmt_fn (DECL_STRUCT_FUNCTION (e->caller->decl), new_stet); }