From: Martin Liska Date: Tue, 3 Mar 2015 12:09:13 +0000 (+0100) Subject: re PR ipa/65282 (wrong code at -Os and above on x86_64-linux-gnu) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3c031cbe7c4b1896dd262a373131fc9a7cb58981;p=gcc.git re PR ipa/65282 (wrong code at -Os and above on x86_64-linux-gnu) Fix PR ipa/65282. * gcc.dg/ipa/PR65282.c: New test. PR ipa/65282 * ipa-icf.c (sem_variable::equals): Fix wrong condition. From-SVN: r221146 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index cb42917f610..f2fd1ff6ffb 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2015-03-03 Martin Liska + + PR ipa/65282 + * ipa-icf.c (sem_variable::equals): Fix wrong condition. + 2015-03-23 Jeff Law PR tree-optimization/65241 diff --git a/gcc/ipa-icf.c b/gcc/ipa-icf.c index 48326185d96..a47ca29aeea 100644 --- a/gcc/ipa-icf.c +++ b/gcc/ipa-icf.c @@ -1638,7 +1638,7 @@ sem_variable::equals (tree t1, tree t2) tree y1 = TREE_OPERAND (t1, 1); tree y2 = TREE_OPERAND (t2, 1); - if (!sem_variable::equals (x1, x2) && sem_variable::equals (y1, y2)) + if (!sem_variable::equals (x1, x2) || !sem_variable::equals (y1, y2)) return false; if (!sem_variable::equals (array_ref_low_bound (t1), array_ref_low_bound (t2))) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 824d2561fea..11ffd258d61 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2015-03-03 Martin Liska + + * gcc.dg/ipa/PR65282.c: New test. + 2015-03-13 Jeff Law PR tree-optimization/65241 diff --git a/gcc/testsuite/gcc.dg/ipa/PR65282.c b/gcc/testsuite/gcc.dg/ipa/PR65282.c new file mode 100644 index 00000000000..58e1c55237b --- /dev/null +++ b/gcc/testsuite/gcc.dg/ipa/PR65282.c @@ -0,0 +1,20 @@ +/* { dg-do compile } */ +/* { dg-options "-Os -fdump-ipa-icf" } */ + +int a[2]; +static int *b = &a[0], *c = &a[1]; + +int +main () +{ + *c = 1; + *b = 0; + + if (a[1] != 1) + __builtin_abort (); + + return 0; +} + +/* { dg-final { scan-ipa-dump "Equal symbols: 0" "icf" } } */ +/* { dg-final { cleanup-ipa-dump "icf" } } */