Bug 228780

Summary: Strict aliasing violations in libc / qsort.c
Product: Base System Reporter: mliska
Component: binAssignee: Konstantin Belousov <kib>
Status: New ---    
Severity: Affects Only Me CC: kib
Priority: --- Keywords: patch
Version: CURRENT   
Hardware: Any   
OS: Any   

Description mliska 2018-06-06 10:18:41 UTC
As seen and explained here:

There are strict aliasing violations:
Comment 1 Konstantin Belousov freebsd_committer 2018-06-06 19:11:50 UTC
So all the fancy swap code should be trimmed down to the byte swap, it seems.
Comment 2 Konstantin Belousov freebsd_committer 2018-06-09 21:01:40 UTC
Comment 3 commit-hook freebsd_committer 2018-06-10 17:55:45 UTC
A commit references this bug:

Author: kib
Date: Sun Jun 10 17:54:44 UTC 2018
New revision: 334928
URL: https://svnweb.freebsd.org/changeset/base/334928

  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

Comment 4 Mark Linimon freebsd_committer freebsd_triage 2018-06-10 23:40:48 UTC
So can this PR be closed now?
Comment 5 commit-hook freebsd_committer 2018-06-24 13:27:26 UTC
A commit references this bug:

Author: kib
Date: Sun Jun 24 13:26:31 UTC 2018
New revision: 335603
URL: https://svnweb.freebsd.org/changeset/base/335603

  MFC r334928:
  libc qsort(3): stop aliasing.

  PR:	228780

_U  stable/11/