This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Unstable build/host qsorts causing differing generated target code
- From: Alexander Monakov <amonakov at ispras dot ru>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: Cory Fields <lists at coryfields dot com>, Jeff Law <law at redhat dot com>, gcc at gcc dot gnu dot org
- Date: Fri, 12 Jan 2018 22:37:38 +0300 (MSK)
- Subject: Re: Unstable build/host qsorts causing differing generated target code
- Authentication-results: sourceware.org; auth=none
- References: <CAApLimj1QbJbNxLJHqYA3pC838rmB7O2W-jGcinE4ZqxUhpR=A@mail.gmail.com> <8c740866-250c-3131-8ad1-6179a509b690@redhat.com> <CAApLimgWTqBCeB6gujmYhCo4avowHgpgHz63RE5-TdEixNLzww@mail.gmail.com> <20180112191940.GH2063@tucnak>
On Fri, 12 Jan 2018, Jakub Jelinek wrote:
> The qsort checking failures are tracked in http://gcc.gnu.org/PR82407
> meta bug, 8 bugs in there are fixed, 2 known ones remain.
Note that qsort_chk only catches really bad issues where the compiler
invokes undefined behavior by passing an invalid comparator to qsort;
differences between Glibc and musl-hosted compilers may remain because
qsort is not quaranteed to be a stable sort: when sorting an array {A, B} where
A and B are not bitwise-identical but cmp(A, B) returns 0, the implementation of
qsort may yield either {B, A} or {A, B}, and that may cause codegen differences.
(in other words, bootstrapping on a libc with randomized qsort has
a good chance to run into bootstrap miscompares even if qsort_chk-clean)
Alexander