From 4bc84763c0b0ac41951f66cd11fb1c27197a03dd Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Tue, 1 Dec 2015 15:47:34 +0000 Subject: [PATCH] re PR tree-optimization/67916 (wrong code at -O3 on x86_64-linux-gnu) PR tree-optimization/67916 * gcc.dg/torture/pr67916.c: New test. From-SVN: r231117 --- gcc/testsuite/ChangeLog | 5 +++ gcc/testsuite/gcc.dg/torture/pr67916.c | 46 ++++++++++++++++++++++++++ 2 files changed, 51 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/torture/pr67916.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index addc4812794..e009034c675 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-12-01 Marek Polacek + + PR tree-optimization/67916 + * gcc.dg/torture/pr67916.c: New test. + 2015-12-01 Marek Polacek PR middle-end/68582 diff --git a/gcc/testsuite/gcc.dg/torture/pr67916.c b/gcc/testsuite/gcc.dg/torture/pr67916.c new file mode 100644 index 00000000000..88541f9acdd --- /dev/null +++ b/gcc/testsuite/gcc.dg/torture/pr67916.c @@ -0,0 +1,46 @@ +/* PR tree-optimization/67916 */ +/* { dg-do run } */ + +int a[6], b = 1, d, e; +long long c; +static int f = 1; + +void +fn1 (int p1) +{ + b = (b >> 1) & (1 ^ a[(1 ^ p1) & 5]); +} + +void +fn2 () +{ + b = (b >> 1) & (1 ^ a[(b ^ 1) & 1]); + fn1 (c >> 1 & 5); + fn1 (c >> 2 & 5); + fn1 (c >> 4 & 5); + fn1 (c >> 8 & 5); +} + +int +main () +{ + int i, j; + for (; d;) + { + for (; e;) + fn2 (); + f = 0; + } + for (i = 0; i < 8; i++) + { + if (f) + i = 9; + for (j = 0; j < 7; j++) + fn2 (); + } + + if (b != 0) + __builtin_abort (); + + return 0; +} -- 2.30.2