]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
libc qsort(3): stop aliasing.
authorkib <kib@FreeBSD.org>
Sun, 10 Jun 2018 17:54:44 +0000 (17:54 +0000)
committerkib <kib@FreeBSD.org>
Sun, 10 Jun 2018 17:54:44 +0000 (17:54 +0000)
commit26c8a03901f609258e58c4e3bfdc981962a638f0
tree09c1a800b55cc207c4f29a3cc87ee6e551e14dfa
parent8f52e72108421d54ab39e7c693f5534d993f46f1
libc qsort(3): stop aliasing.

Qsort swap code aliases the sorted array elements to ints and longs in
order to do swap by machine words.  Unfortunately this breaks with the
full code optimization, e.g. LTO.

See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83201 which seems to
reference code directly copied from libc/stdlib/qsort.c.

PR: 228780
Reported by: mliska@suse.cz
Reviewed by: brooks
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D15714
lib/libc/stdlib/qsort.c