This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Add Berkeley qsort to libiberty to make GCC host-independent
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Felix Yang <fei dot yang0953 at gmail dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, ian at airs dot com, dj at redhat dot com, vmakarov at redhat dot com
- Date: Wed, 13 Aug 2014 14:16:43 +0200
- Subject: Re: [PATCH] Add Berkeley qsort to libiberty to make GCC host-independent
- Authentication-results: sourceware.org; auth=none
- References: <CAFc0fxx7V6o-d0adJfbQ7=+zXFTu8Ebh0sY9oPJP0L8xrJ6oEA at mail dot gmail dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Wed, Aug 13, 2014 at 08:12:03PM +0800, Felix Yang wrote:
> The qsort library function may have different behavior on
> different hosts (say Linux vs MinGW).
> We may have different sorting results with qsort when there are
> elements with the same key value.
> GCC uses qsort a lot. And the output of certain optimizations,
> such as IRA, relies on the sorting result of this library function.
> The problem is that we may have different assembly code of GCC on
> different hosts even with the same source file.
> Normally this is not what a GCC user expect to see.
> In order to fix this issue, I am adding Berkeley qsort to
> libiberty in order to override the one from the library.
Why have you picked a BSD one rather than the GNU one?
glibc qsort is highly optimized and has some other nice properties qsort
from many other sources does not have.
Jakub