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; +}