From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 6CB743851C1C; Thu, 15 Apr 2021 21:39:10 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 6CB743851C1C From: "msebor at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/85563] [8/9/10/11 regression] -Wmaybe-uninitialized false alarm regression with __builtin_unreachable and GCC 8 Date: Thu, 15 Apr 2021 21:39:10 +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: 8.0.1 X-Bugzilla-Keywords: deferred, diagnostic, missed-optimization X-Bugzilla-Severity: normal X-Bugzilla-Who: msebor 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.0 X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: keywords cf_reconfirmed_on cc cf_known_to_fail 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: Thu, 15 Apr 2021 21:39:10 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D85563 Martin Sebor changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |missed-optimization Last reconfirmed|2018-04-30 00:00:00 |2021-4-15 CC| |msebor at gcc dot gnu.org Known to fail|8.0.1 |10.2.0, 11.0, 8.3.0, 9.3.0 --- Comment #18 from Martin Sebor --- Reconfirming with GCC 11. Inverting the reachability expression: ((CONSP (Vframe_list)) ? (void) 0 : __builtin_unreachable ()); to (!(CONSP (Vframe_list)) ? __builtin_unreachable () : (void) 0); or changing it to a corresponding if statement avoids the warning and impro= ves the emitted code, implying there is a missed optimization opportunity there somewhere. I also reduced the test from comment #6 a bit further to make it easier to read: struct A { struct A *p, *q; }; extern void *p; inline _Bool f (void* a) { return ((__INTPTR_TYPE__) (a) & ~(- (1 << 3))) =3D=3D 3; } inline struct A * g (void* a) { return (struct A *)((char *)a - 3); } extern void* foo (void*); void bar (void) { #if NOWARN if (!f (p)) __builtin_unreachable (); #else f (p) ? (void)0 : __builtin_unreachable (); #endif void* q; for (void *r =3D p; f (r) && ((q =3D g (r)->p), 1); r =3D g (r)->q) ; foo (q); }=