From 6a927313920b04c44f33ac8f784103236a324ef0 Mon Sep 17 00:00:00 2001 From: Teresa Johnson Date: Mon, 6 May 2013 12:46:53 +0000 Subject: [PATCH] re PR bootstrap/57154 (Bootstrap broken for powerpc64-unknown-linux-gnu) 2013-05-03 Teresa Johnson PR bootstrap/57154 * gcc.dg/pr57154.c: New test. From-SVN: r198626 --- gcc/testsuite/ChangeLog | 5 ++++ gcc/testsuite/gcc.dg/pr57154.c | 43 ++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/pr57154.c diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index b4e04799c9d..26cc566c763 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-05-03 Teresa Johnson + + PR bootstrap/57154 + * gcc.dg/pr57154.c: New test. + 2013-05-06 Richard Biener PR middle-end/57147 diff --git a/gcc/testsuite/gcc.dg/pr57154.c b/gcc/testsuite/gcc.dg/pr57154.c new file mode 100644 index 00000000000..5a6531a32a4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/pr57154.c @@ -0,0 +1,43 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fschedule-insns" } */ + +#define PF_FROZEN 0x00010000 +#define likely(x) __builtin_expect(!!(x), 1) + +struct cur +{ + unsigned long flags; +}; +struct cur *cur; + +unsigned long freeze_cnt; + +extern int foo(void *); +extern int slow_path(void *); + +static inline int freezing(void *p) +{ + if (likely(!foo(&freeze_cnt))) + return 0; + return slow_path(p); +} + +extern int blah(void); + +int testcase(int check_kthr_stop) +{ + int was_frozen = 0; + + for (;;) { + if (!freezing(cur) || + (check_kthr_stop && blah())) + cur->flags &= ~PF_FROZEN; + + if (!(cur->flags & PF_FROZEN)) + break; + + was_frozen = 1; + } + + return was_frozen; +}