From: Martin Liska Date: Tue, 23 Dec 2014 09:30:20 +0000 (+0100) Subject: Fix for PR ipa/63851 and ipa/63852. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=34b42fb0ea1bdcdc0eb9dc5d90eeb780fa017923;p=gcc.git Fix for PR ipa/63851 and ipa/63852. PR ipa/63851 PR ipa/63852 * ipa-icf.c (sem_function::merge): Ignore merge operation for a thunk created from static chain. * ipa-icf-gimple.c (func_checker::compatible_types_p): Verify that types have same restrict flag. From-SVN: r219042 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9f0408506a5..133d8aa763f 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2014-12-23 Martin Liska + + PR ipa/63851 + PR ipa/63852 + * ipa-icf.c (sem_function::merge): Ignore merge operation + for a thunk created from static chain. + * ipa-icf-gimple.c (func_checker::compatible_types_p): Verify that + types have same restrict flag. + 2014-12-22 John David Anglin PR target/55023 diff --git a/gcc/ipa-icf-gimple.c b/gcc/ipa-icf-gimple.c index fa2c3534d8d..6689463585e 100644 --- a/gcc/ipa-icf-gimple.c +++ b/gcc/ipa-icf-gimple.c @@ -185,6 +185,9 @@ bool func_checker::compatible_types_p (tree t1, tree t2, if (TREE_CODE (t1) != TREE_CODE (t2)) return return_false_with_msg ("different tree types"); + if (TYPE_RESTRICT (t1) != TYPE_RESTRICT (t2)) + return return_false_with_msg ("restrict flags are different"); + if (!types_compatible_p (t1, t2)) return return_false_with_msg ("types are not compatible"); diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c index 6cdc21b1ae6..b8ef6e03fb4 100644 --- a/gcc/ipa-icf.c +++ b/gcc/ipa-icf.c @@ -694,6 +694,14 @@ sem_function::merge (sem_item *alias_item) return 0; } + if (DECL_STATIC_CHAIN (alias->decl)) + { + if (dump_file) + fprintf (dump_file, "Thunk creation is risky for static-chain functions.\n\n"); + + return 0; + } + alias->icf_merged = true; ipa_merge_profiles (local_original, alias); alias->create_wrapper (local_original);