From nobody Tue Jun 2 03:40:46 2026 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4gTxSG3bN6z6glXD for ; Tue, 02 Jun 2026 03:40:46 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4gTxSG1DWWz3MKq for ; Tue, 02 Jun 2026 03:40:46 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780371646; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OfDpeS193xwYIbZl+7EeWUnrUdpgA+A2KvCny7K8EZI=; b=lxZywRERq20NiDpbKeqOzQTZw23d9ag+43v+8/7f3j4RR04fgVH4DscwcVeAN2/DauAh3b Zl3Z8SMVsI3YhfaujopByyvWIsvy4KOuvsv18BuleoSHn0BkbPcppmVij01vPlWn44q30E hrvtFB2Wp5baKOZaW7vHyAN5FwJ9Tg8ITq64nVYecCtSkDZdDC6bCXCplC1sFZRbGyDmB9 eFoPvxeft2QvuVLmCkrF2lL1mmpFAkqOv5QvnG/eqy980bl+0NXTlgdZw4QS2QNLICr/S3 P3LQvSs9WJk5ScmFwIFV8Lh9SQqof79zyUK0kuhpgI9TUUakdnFEpvF/NtU2fA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780371646; a=rsa-sha256; cv=none; b=TBuv3aEqIqpB+AykVZqg7fWoOaqaXuMYgKsot5cqUSkyB5uupnCek5EtEoj+eX2YJ2VFyx m6G/HmjOuLl3w2DQR4JBiLP+teWDi09J4X3iOo8kBMMpOpeWF2FYth5bDkaKO81CDtzQMp 80LHFC6YwJQZI9n6r2x7L0EaoTSyESPThZw2lfOadr6b+mC2nhWdLFuoSM5/OoSG0A0lCv t4Jz0M1tthYBeR0JoUOsGnr1a0bJ12gUqctfJPzpJq0oKrjac95MeahFYTUyGoF8Qlzca3 lZjBRUl0KSF7Qn+YNxg5u1NOk7XVvmeelVq4JPiOkpsO7DD/rSELzuhKQEJcog== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780371646; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=OfDpeS193xwYIbZl+7EeWUnrUdpgA+A2KvCny7K8EZI=; b=PPr5IyIkNeZa55zl/Wu4W6pJp8gAakCJYpRoxaIu/R7t9C4T4oe7+/rplEAYJx52RD0eUP EQsqqFS3h+EHbiTxwZoD5rRYT23FsojzcG619zJXkZZ8WulixQoo3fvl2+uh6jt5gH7RPk XekkbDhn9O5aWX+mMwFue6ozTvDFznfpVbCfdXLQLc/1iqaa6t6ocVqCnq4NCCt4lLUqwx eK5DxluUgHl+bbM07J7wZsi690xbyy8WA/3y7duLqVCjpbcElJ+DC0H7swuzuoies9lX8U QA20NMIIJ586RRFTuKkmXK4C3UfglL7KrYMUjiansEZi/payTfc8LQC20D8k+g== Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4gTxSG0qK6z16NV for ; Tue, 02 Jun 2026 03:40:46 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 6523ektI052893 for ; Tue, 2 Jun 2026 03:40:46 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 6523ekvA052892 for bugs@FreeBSD.org; Tue, 2 Jun 2026 03:40:46 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 295784] mergesort{,_b} should accept element size smaller than sizeof(void *) Date: Tue, 02 Jun 2026 03:40:46 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: misc X-Bugzilla-Version: 16.0-CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: minsoochoo0122@proton.me X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="UTF-8" X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@FreeBSD.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D295784 Bug ID: 295784 Summary: mergesort{,_b} should accept element size smaller than sizeof(void *) Product: Base System Version: 16.0-CURRENT Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: misc Assignee: bugs@FreeBSD.org Reporter: minsoochoo0122@proton.me Currently mergesort{,_b} (see qsort(3)) do not accept element size smaller = than sizeof(void *). This happens due an optimization trick to reduce heap allocation by embedding run-boundary pointers in list2 along with data. However, this is not an adequate optimization method for a standard library utility because it rejects arrays composed of basic types such as char and short. This restriction only applies to mergesort (i.e. qsort and heapsort don't have this restriction). Solution: separate pointers from list2. In worst case (size=3D=3D4), the me= mory allocation will increase by 2x as we need O(n/2) for run-boundary pointers. Still, the nature of standard library is enough to justify this tradeoff. --=20 You are receiving this mail because: You are the assignee for the bug.=