Hello,

On 24.07.2012 18:56, Steven Bosscher wrote:
On Tue, Jul 24, 2012 at 4:37 PM, Steven Bosscher<stevenb....@gmail.com>  wrote:
On Tue, Jul 24, 2012 at 3:08 PM, Uros Bizjak<ubiz...@gmail.com>  wrote:
This patch (r189803) regressed a bunch of tests on x86_64 [1], [2].

[1] http://gcc.gnu.org/ml/gcc-testresults/2012-07/msg02066.html
[2] http://gcc.gnu.org/ml/gcc-regression/2012-07/msg00177.html

These are all selective-scheduler test cases. It looks like qsort is
being used incorrectly.

This seems to fix it for me, but I don't understand why. Apparently, a
pointer subtraction doesn't result in a signed value?? In any case,
the sort on those arrays wasn't correct. Comments?

Index: sel-sched-ir.c
===================================================================
--- sel-sched-ir.c      (revision 189808)
+++ sel-sched-ir.c      (working copy)
@@ -954,7 +954,9 @@ return_regset_to_pool (regset rs)
  static int
  cmp_v_in_regset_pool (const void *x, const void *xx)
  {
-  return *((const regset *) x) - *((const regset *) xx);
+  ptrdiff_t d = (ptrdiff_t) *((const regset *) x);
+  ptrdiff_t dd = (ptrdiff_t) *((const regset *) xx);
+  return d - dd;

AFAIR the qsort is just for getting a stable ordering over two pools to find the leaked regsets afterwards, the type of ordering doesn't matter. Anyways, how come this is related to your patch? We don't use statistics in sel-sched... Something got miscompiled?

Andrey


  }
  #endif

Reply via email to