From patchwork Tue Jul 24 14:56:41 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: un-#ifdef GATHER_STATISTICS Date: Tue, 24 Jul 2012 04:56:41 -0000 From: Steven Bosscher X-Patchwork-Id: 172894 Message-Id: To: Uros Bizjak , Andrey Belevantsev , "H.J. Lu" Cc: gcc-patches@gcc.gnu.org, Richard Guenther On Tue, Jul 24, 2012 at 4:37 PM, Steven Bosscher wrote: > On Tue, Jul 24, 2012 at 3:08 PM, Uros Bizjak 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