From nobody Tue Aug 12 01:10:52 2025 X-Original-To: numerics@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 4c1D30484Lz64CLk for ; Tue, 12 Aug 2025 01:10:52 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4c1D301zCXz4HmB for ; Tue, 12 Aug 2025 01:10:52 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1754961052; 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: in-reply-to:in-reply-to:references:references; bh=/rNWSkTC87bWV4/NPLLDo5Ybqj26Bbp/VpOli5dRutU=; b=xqUszR1lTW2TFcRaMGW86DdYQq9ge8wXYrxPHAZCt2PlIVmGc9dTeorKolqzQ8UAi3VQ68 1XmMvGg7gtLlbY+ZHzhi8JRLrEOnhVRaatv9mUCHHmW/m6K4Pzs3MvMHH06mzKPwt4WrBq 6t867y06cPnrpW3c6Cv87xNaQveYbWseXAsC0X/ZASiYgaDYFgmShX2Q7AjHnx4KSK/Asm 2HwX4c4pKq7uCJE5wfLm+kmN7HM47j8SjNP5IlO0M+kXde8U6PSJUfg8oVG6xUIDzr3bCy kA8Ca2kF+83pHjjUQOcJjD60NXRIcI7xcQF7hxOqBkgyQwGn/yp7Qx3jqaeinA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1754961052; 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: in-reply-to:in-reply-to:references:references; bh=/rNWSkTC87bWV4/NPLLDo5Ybqj26Bbp/VpOli5dRutU=; b=LyBmXgCxs8FA//q6PTmauI73TPpSXMFJqhAZywydUcNHDs9rW7j/JIvTlhVcUvzzKnJI6+ clThp7REkfjm2NLfZzws0INmmtkOYR8ktttaxoewoC4m+Xn0hfLIGiOaREWkzQ+qBT4U6F IDcomEtzukMSvw/1+Ei46PKsd1jAFppRqaj5XSl7uuoCkwynQnW9gQi79P1CVnDnCy1x7+ FqcDpMwehdt6LTOdrS38VRWpyrESlq0I1IfS7X97e+aFaBYFr8A4M2yTvX+msGPe+cUajm oTgEDXt8Rvn0X6kGP+SFfq7Ar7m5rHIEEOCuaZz5K3T+XIR9YPO/Y1cKvJepFA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1754961052; a=rsa-sha256; cv=none; b=m0KtMY/6rptvtoWH4iUI4iZZOZJK5CjmaOp5x+Jy2CmgaWfEEVwCnNHO4KrfAwOyDEIpzd yx0YOK7TAxAzeY6yGt8zLJkv8EY616K/Yimyj1qX75e/RSCdX2A1cWS5HMh+T3R4NzeKBp 1ClVpo4YjygPtPIUcjmROAm9XcbRbc2zhJirgbjY1H7tu78pgORjnyOCdIyyOLL5aQSinu 91etLLqCWVlysW9Ss72Zti/mVrc2/2TqioCyaOfr4yI2uD2h3FxIaviZMfkN1Ge95UBMd9 TNBqcCsTSDrVe6QuXoV6cTYHogFav1knHkRxc/R8aEknmxIz7nHPE87GS9QZwg== 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 4c1D301NYtz233 for ; Tue, 12 Aug 2025 01:10:52 +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 57C1AqmF052387 for ; Tue, 12 Aug 2025 01:10:52 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 57C1Aq8s052376 for numerics@FreeBSD.org; Tue, 12 Aug 2025 01:10:52 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: numerics@FreeBSD.org Subject: [Bug 288778] [libm] Fix undefined behavior of a left shifted of a signed integer Date: Tue, 12 Aug 2025 01:10:52 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: bin X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: kib@FreeBSD.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: numerics@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc Message-ID: In-Reply-To: References: 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: Discussions of high quality implementation of libm functions List-Archive: https://lists.freebsd.org/archives/freebsd-numerics List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-numerics@FreeBSD.org MIME-Version: 1.0 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D288778 Konstantin Belousov changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kib@FreeBSD.org --- Comment #2 from Konstantin Belousov --- The motivation for the UB in signed left shift is that C standard allows several signed integer representations, e.g. 2-complement as used by all architectu= res supported by FreeBSD, or 1-complement, or sign-bit. Then it is obvious why they stated that this is UB: depending on the representation, when the shift moves non-zero bit into the sign position, the result interpreted as signed integer would have different signed integer value on different arches while having the same bit pattern. But the problem is not that, but the current interpretation of UB by compil= ers. They consider UB as a license to introduce arbitrary behavior into the comp= iled code. The specific case might be not utilized (AKA broken) right now, but = the next version of a compiler can do it. So fixing UB is vital to avoid damage from hostile compiler authors. --=20 You are receiving this mail because: You are the assignee for the bug.=