From f45be077ec1a40e5b3046cd19bd32e8e1ebaca73 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Mon, 23 Mar 2015 16:17:20 +0100 Subject: [PATCH] re PR ipa/65521 (nondeterministic -fcompare-debug failures) PR ipa/65521 * ipa-icf.c (sem_item::update_hash_by_addr_refs): Hash ultimate_alias_target ()->order ints instead of ultimate_alias_target () pointers. * gcc.dg/pr65521.c: New test. From-SVN: r221596 --- gcc/ChangeLog | 7 ++++++ gcc/ipa-icf.c | 4 ++-- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/pr65521.c | 39 ++++++++++++++++++++++++++++++++++ 4 files changed, 53 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/pr65521.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 724d13fd0d8..d6603636c5b 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2014-03-23 Jakub Jelinek + + PR ipa/65521 + * ipa-icf.c (sem_item::update_hash_by_addr_refs): Hash + ultimate_alias_target ()->order ints instead of + ultimate_alias_target () pointers. + 2015-03-23 Richard Biener PR tree-optimization/65518 diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c index bdfbd3ba362..48a7d3d15d6 100644 --- a/gcc/ipa-icf.c +++ b/gcc/ipa-icf.c @@ -575,7 +575,7 @@ sem_item::update_hash_by_addr_refs (hash_map iterate_reference (i, ref); if (ref->address_matters_p () || !m_symtab_node_map.get (ref->referred)) - hstate.add_ptr (ref->referred->ultimate_alias_target ()); + hstate.add_int (ref->referred->ultimate_alias_target ()->order); } if (is_a (node)) @@ -585,7 +585,7 @@ sem_item::update_hash_by_addr_refs (hash_map callee); if (!result) - hstate.add_ptr (e->callee->ultimate_alias_target ()); + hstate.add_int (e->callee->ultimate_alias_target ()->order); } } diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e6e63d1a10e..d3958f67124 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2014-03-23 Jakub Jelinek + + PR ipa/65521 + * gcc.dg/pr65521.c: New test. + 2015-03-23 Richard Biener PR tree-optimization/65518 diff --git a/gcc/testsuite/gcc.dg/pr65521.c b/gcc/testsuite/gcc.dg/pr65521.c new file mode 100644 index 00000000000..97879e2e139 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr65521.c @@ -0,0 +1,39 @@ +/* PR ipa/65521 */ +/* { dg-do compile } */ +/* { dg-options "-O2 -fcompare-debug" } */ + +struct S { int s; }; +int f6 (void *, unsigned long); +int f7 (int, int *, unsigned long); +int f8 (void); +int f9 (void (*) (void)); + +int +f1 (void *p) +{ + return f6 (p, 256UL); +} + +int +f2 (void *p) +{ + return f6 (p, 256UL); +} + +int +f3 (struct S *x) +{ + return f7 (f8 (), &x->s, 16UL); +} + +int +f4 (struct S *x) +{ + return f7 (f8 (), &x->s, 16UL); +} + +void +f5 (void) +{ + f9 (f5); +} -- 2.30.2