------- Comment #15 from ebotcazou at gcc dot gnu dot org 2009-02-08 10:58
-------
> This is a bug in the qsort implementation on Solaris 8:
Browsing the Sun database shows several related tickets, but most have been
closed as "not a defect" on the ground that the comparator function fails to
impose a total order on the array. That's the case here because of overflow:
(gdb) p cl->sorted[0].cost
$29 = 2147483646
(gdb) p cl->sorted[1].cost
$30 = -2147483644
(gdb) p cl->sorted[2].cost
$31 = -2147483648
(gdb) p cl->sorted[3].cost
$32 = 2
(gdb) p cl->sorted[4].cost
$33 = -2147483648
(gdb) p cl->sorted[5].cost
$34 = 2
(gdb) p cl->sorted[6].cost
$35 = 2147483646
(gdb) p cl->sorted[7].cost
$36 = 2147483646
Breakpoint 2, compare_pairs (p1=0x1cc4e88, p2=0x1cc4e8c)
at /nile.build/botcazou/gcc-head/src/gcc/tree-ssa-coalesce.c:314
314 const_coalesce_pair_p const *const pp1 = (const_coalesce_pair_p const
*) p1;
(gdb) next
315 const_coalesce_pair_p const *const pp2 = (const_coalesce_pair_p const
*) p2;
(gdb)
318 result = (* pp2)->cost - (* pp1)->cost;
(gdb) p (* pp2)->cost
$46 = -2147483644
(gdb) p (* pp1)->cost
$47 = 2147483646
(gdb) next
322 if (result == 0)
(gdb) p result
$48 = 6
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38981