From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D9EE63842438; Wed, 9 Dec 2020 09:16:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D9EE63842438 From: "rguenther at suse dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/98190] [11 Regression] GCC11 miscompiles code using _Bool when inlining: bfxil instruction misused since r11-165 Date: Wed, 09 Dec 2020 09:16:51 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: middle-end X-Bugzilla-Version: 11.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: rguenther at suse dot de X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P1 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 11.0 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: Wed, 09 Dec 2020 09:16:52 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D98190 --- Comment #11 from rguenther at suse dot de --- On Wed, 9 Dec 2020, rsandifo at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D98190 >=20 > --- Comment #10 from rsandifo at gcc dot gnu.org --- > (In reply to Jakub Jelinek from comment #9) > > Perhaps some of those checks on the other side are redundant and could = be > > turned e.g. into gcc_checking_assert of gcc_assert, I bet if the MEM_REF > > doesn't overwrite all bits, but only some subset of them, then the > > destination couldn't be a nonmem decl and thus couldn't be promoted. > Yeah, asserting sounds good. Checking the other conditions makes it > look like we could still fall through to the else for some promoted > subregs. >=20 > If we can't assert, I guess the rule is that we need to extend > whenever we're storing to the MSB of the inner register. We can > do that either by extending the source value and the range to > the outer register, or by assigning to the inner register and > then extending it separately. So I guess if you do a GIMPLE FE testcase with a __BIT_INSERT to the MSB of a promoted var that should end up doing the extension as well? Like (probably doesn't parse, needs a 1-bit precision '1') signed char __GIMPLE () foo() { signed char _1; signed char _2; __BB(2): _2 =3D __BIT_INSERT (_1(D), 1, 7); return _2; } int main() { if (foo() > 0) abort (); } ?=