Hi, according to my type checker, ipa-prop is only place where we produce a variant of a METHOD_TYPE that is FUNCTION_TYPE or viarant that has different parameters.
The code in question is producing new prototype to remove unused arguments, but I do not think it should eclare the new type to be variant of the original. Historically I think I introduced the code because I simply copied what linker does without caring too much about the consequences. Bootstrapped/regtested x86_64-linux, OK? * ipa-prop.c (ipa_modify_formal_parameters): Do not declare new type to be variant of original type. Index: ipa-prop.c =================================================================== --- ipa-prop.c (revision 215615) +++ ipa-prop.c (working copy) @@ -3990,21 +3990,6 @@ DECL_FUNCTION_CODE (fndecl) = (enum built_in_function) 0; } - /* This is a new type, not a copy of an old type. Need to reassociate - variants. We can handle everything except the main variant lazily. */ - tree t = TYPE_MAIN_VARIANT (orig_type); - if (orig_type != t) - { - TYPE_MAIN_VARIANT (new_type) = t; - TYPE_NEXT_VARIANT (new_type) = TYPE_NEXT_VARIANT (t); - TYPE_NEXT_VARIANT (t) = new_type; - } - else - { - TYPE_MAIN_VARIANT (new_type) = new_type; - TYPE_NEXT_VARIANT (new_type) = NULL; - } - TREE_TYPE (fndecl) = new_type; DECL_VIRTUAL_P (fndecl) = 0; DECL_LANG_SPECIFIC (fndecl) = NULL;