From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 0C64C387542E; Wed, 4 Oct 2023 15:55:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0C64C387542E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1696434935; bh=nMTGyvHLcbLIgyPEP+zkmexRZPfpNBO+G7KD1sMtXhM=; h=From:To:Subject:Date:In-Reply-To:References:From; b=lcr5/2pBM/F0zY0VboPlPRTv11qgqOEjf2WYvAXRedd0WlkQjomTxpaFGNcwgjkl8 1j1l7VkHje6hk82iPUBL4pE8+CdUKUFEsf6s1f78nUvjDTa46VsNMrZlCDIsde33Gr vBYarFDBT8rnysEE7kK3hs1JbqrOHIFtpc+Svb3I= From: "pinskia at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/110643] [13/14 Regression] aarch64: Miscompilation at O1 level (O0 is working) Date: Wed, 04 Oct 2023 15:55:34 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: target X-Bugzilla-Version: 13.1.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: pinskia at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: MOVED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 13.3 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: resolution bug_status Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D110643 Andrew Pinski changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |MOVED Status|WAITING |RESOLVED --- Comment #22 from Andrew Pinski --- template HWY_API Mask128 IsInf(const Vec128 v) { const DFromV d; const RebindToSigned di; const VFromD vi =3D BitCast(di, v); // 'Shift left' to clear the sign bit, check for exponent=3Dmax and manti= ssa=3D0. return RebindMask(d, Eq(Add(vi, vi), Set(di, hwy::MaxExponentTimes2())= )); } Most likely should have been: ``` template HWY_API Mask128 IsInf(const Vec128 v) { const DFromV d; const RebindToUnsigned du; const VFromD vi =3D BitCast(du, v); // 'Shift left' to clear the sign bit, check for exponent=3Dmax and manti= ssa=3D0. return RebindMask(d, Eq(Add(vi, vi), Set(du, hwy::MaxExponentTimes2())= )); } ``` I noticed the bug happens in other places in highway for other targets too (including x86_64). this code is undefined due to an signed integer overflow and that is why us= ing unsigned is needed. Yes -fsanitize=3Dundefined does not currently work for vectors (that is a k= nown limitation).=