From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 252B53857C6B; Mon, 11 Oct 2021 09:22:32 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 252B53857C6B From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/102622] [9/10 Regression] Wrong code with -O1 and above due to phiopt and signed one bit integer types Date: Mon, 11 Oct 2021 09:22:32 +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: 12.0 X-Bugzilla-Keywords: patch, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: pinskia at gcc dot gnu.org X-Bugzilla-Target-Milestone: 9.5 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 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: Mon, 11 Oct 2021 09:22:33 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D102622 --- Comment #24 from CVS Commits --- The releases/gcc-10 branch has been updated by Andrew Pinski : https://gcc.gnu.org/g:4111b36079fed95b787fafeed1deaab2dedaf3db commit r10-10177-g4111b36079fed95b787fafeed1deaab2dedaf3db Author: Andrew Pinski Date: Sun Oct 10 23:12:11 2021 +0000 [GCC 10 branch] tree-optimization: [PR102622]: wrong code due to signed= one bit integer and "a?-1:0" So here is the GCC 10 branch version which fixes the wrong code. The problem is we create a negation of an one bit signed integer type which is undefined if the value was -1. This is not needed for GCC 11 branch since the case is handled differen= tly there and has been fixed there (and the trunk has now been fixed too). So for one bit types, there is no reason to create the negation so just setting neg to false for them, just works. OK? Bootstrapped and tested on x86_64-linux-gnu. PR tree-optimization/102622 gcc/ChangeLog: * tree-ssa-phiopt.c (conditional_replacement): Set neg to false for one bit signed types. gcc/testsuite/ChangeLog: * gcc.c-torture/execute/bitfld-10.c: New test.=