From 3c88da0dd48b5ec43916614974e45d239236d9cf Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Tue, 28 Nov 2017 11:22:31 +0100 Subject: [PATCH] re PR rtl-optimization/81020 (wrong code with -O -fno-tree-bit-ccp -fno-tree-coalesce-vars -fno-tree-vrp) PR rtl-optimization/81020 * gcc.dg/pr81020.c: New test. From-SVN: r255193 --- gcc/testsuite/ChangeLog | 3 +++ gcc/testsuite/gcc.dg/pr81020.c | 23 +++++++++++++++++++++++ 2 files changed, 26 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr81020.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index fd6475f31b3..6f3b47585d5 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,5 +1,8 @@ 2017-11-28 Jakub Jelinek + PR rtl-optimization/81020 + * gcc.dg/pr81020.c: New test. + PR tree-optimization/80788 * gcc.dg/pr80788.c: New test. diff --git a/gcc/testsuite/gcc.dg/pr81020.c b/gcc/testsuite/gcc.dg/pr81020.c new file mode 100644 index 00000000000..8789c657a2f --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr81020.c @@ -0,0 +1,23 @@ +/* PR rtl-optimization/81020 */ +/* { dg-do run } */ +/* { dg-options "-O -fno-tree-bit-ccp -fno-tree-coalesce-vars -fno-tree-vrp" } */ + +unsigned v = 4; + +unsigned long long __attribute__((noipa)) +foo (unsigned x) +{ + unsigned a = v; + a &= 1; + x |= 0 < a; + a >>= 31; + return x + a; +} + +int +main () +{ + if (foo (2) != 2) + __builtin_abort (); + return 0; +} -- 2.30.2