From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id E30F13857718; Thu, 27 Apr 2023 12:02:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E30F13857718 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1682596966; bh=k4PTGtimSaDLz8hWFlyp6wunwpCbmm2J/v2/QvSLLOY=; h=From:To:Subject:Date:In-Reply-To:References:From; b=DYLGhyvG9YOFTQvK9ztKBi2hJDcjhuHhY8omvOAm/xe/8OFvsW3KV48XuXabEr0iN VbUIe200NT7Rukk1N9rcpPzzKOywYVkffGWGhxgM9MdpcKu0817dVJEaGz30xiCF31 YavTlTAp9So4vQzCAuFeU7Ib5vQ+qhepYd70c4Xc= From: "rguenth at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug target/107131] [11/12 Regression] wrong code with -Os -fno-ipa-vrp -fno-tree-bit-ccp Date: Thu, 27 Apr 2023 12:02:46 +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.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenth at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.4 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: 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=3D107131 --- Comment #11 from Richard Biener --- (In reply to Jakub Jelinek from comment #8) > I think the problem happens during combine. Parts of the vector code > related to: > V b =3D (V) { } >=3D o; > V c =3D b <=3D (V)(b >=3D (V) { 0, 0, 0, 0, 0, 0x90DF0BE3990AC871ULL }); > - in particular the scalar c[5] computation, i.e. > unsigned long long b =3D 0 >=3D o ? -1ULL : 0ULL; > unsigned long long c =3D b <=3D (b >=3D 0x90DF0BE3990AC871ULL ? -1ULL : 0= ULL) ? > -1ULL : 0ULL; > evaluates to 0 rather than -1 that it should when o is 0. >=20 > This boils down to: > __attribute__((noipa)) unsigned long long > foo (unsigned char o) > { > unsigned long long t1 =3D -(long long) (o =3D=3D 0); > unsigned long long t2 =3D -(long long) (t1 > 10439075533421201520ULL); > unsigned long long t3 =3D -(long long) (t1 <=3D t2); > return t3; > } >=20 > int > main () > { > if (foo (0) !=3D -1ULL) > __builtin_abort (); > return 0; > } > at -O2 or -Os, which was miscompiled starting with r12-303-g86403f4e6e5f7= 216 > and got fixed with r13-3530-g0e36a9c6915c713d30. > No idea why this is marked as 11 regression though... >=20 > So, do we need to backport PR107172 change to 12 branch? Yes. Testing that now.=