From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 343ED3842418; Fri, 12 Feb 2021 19:09:47 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 343ED3842418 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/99079] Maybe a wrong code since r6-1462-g4ab1e111ef0669bb Date: Fri, 12 Feb 2021 19:09:47 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: tree-optimization X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: jakub at gcc dot gnu.org X-Bugzilla-Target-Milestone: 8.5 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: attachments.isobsolete attachments.created 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 12 Feb 2021 19:09:47 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D99079 Jakub Jelinek changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #50175|0 |1 is obsolete| | --- Comment #3 from Jakub Jelinek --- Created attachment 50176 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D50176&action=3Dedit gcc11-pr99079.patch Updated patch. Actually, I think widening conversion from signed TREE_TYPE (@1) to signed type is fine too. In the problematic case where @1 is negative (i.e. powerof2 << var which sh= ifts it into the sign bit, certainly valid at least in C++20), if we say have in= t to long long conversion and we know the dividend is non-negative, it would be @0 % (long long) INT_MIN, i.e. @0 % -0x80000000LL and that can still be expanded as @0 & 0x7fffffffLL.=