This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix PR bootstrap/57154 (issue9179043)


Here is the patch with the new test case. Tested using dejagnu with
and without my fix for PR57154 to confirm that it exposes the failure
and works with the patch.

Ok for trunk?

Thanks,
Teresa

2013-05-03  Teresa Johnson  <tejohnson@google.com>

PR bootstrap/57154
* gcc.dg/pr57154.c: New test.

Index: gcc.dg/pr57154.c
===================================================================
--- gcc.dg/pr57154.c (revision 0)
+++ gcc.dg/pr57154.c (revision 0)
@@ -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;
+}

On Fri, May 3, 2013 at 10:34 AM, Teresa Johnson <tejohnson@google.com> wrote:
> On Fri, May 3, 2013 at 10:28 AM, David Edelsohn <dje.gcc@gmail.com> wrote:
>> On Fri, May 3, 2013 at 1:26 PM, Jeff Law <law@redhat.com> wrote:
>>> On 05/03/2013 11:15 AM, Teresa Johnson wrote:
>>>>
>>>> On Fri, May 3, 2013 at 9:37 AM, David Edelsohn <dje.gcc@gmail.com> wrote:
>>>>>
>>>>> Thanks for the patch.
>>>>>
>>>>> Bootstrap works on x86 and Anton's testcase works on x86.
>>>>>
>>>>> Is there any testcase for x86 that would demonstrate the failure or
>>>>> that could check the probabilities in a dump file and see the
>>>>> inconsistency?
>>>>
>>>>
>>>> Patch is committed. But I just figured out why it isn't showing up on
>>>> x86 - it is because -fschedule-insns is not enabled by default. I can
>>>> reproduce it with x86 using the same test case. Will go ahead and
>>>> submit a patch to add this to the testsuite.
>>>
>>> Just an FYI, we don't use -fschedule-insns (first pass) on x86/x86_64 due to
>>> register pressure issues.   However, I think for the testsuite it'd be OK to
>>> have a test which uses -fschedule-insns to expose the need for clamping on
>>> the probabilities.
>>
>> Then Anton's testcase would make a good addition, with explicit
>> -fschedule-insns.
>
> Yep, getting that patch ready right now.
> Teresa
>
>>
>> Thanks, David
>
>
>
> --
> Teresa Johnson | Software Engineer | tejohnson@google.com | 408-460-2413



-- 
Teresa Johnson | Software Engineer | tejohnson@google.com | 408-460-2413


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]