On Tue, Jul 24, 2012 at 4:37 PM, Steven Bosscher <[email protected]> wrote:
> On Tue, Jul 24, 2012 at 3:08 PM, Uros Bizjak <[email protected]> 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;
}
#endif