From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 5B237384B072; Tue, 6 Apr 2021 23:16:50 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5B237384B072 From: "msebor at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug tree-optimization/90710] Bogus Wmaybe-uninitialized caused by __builtin_expect when compiled with -Og Date: Tue, 06 Apr 2021 23:16:50 +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: 9.1.0 X-Bugzilla-Keywords: diagnostic X-Bugzilla-Severity: normal X-Bugzilla-Who: msebor at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- 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: Tue, 06 Apr 2021 23:16:50 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D90710 --- Comment #4 from Martin Sebor --- Here's a smaller test case showing both the problem (first gcc invocation) = and how it can be avoided (second invocation): $ (set -x && cat pr90710.c && gcc -Og -S -Wall pr90710.c && gcc -Dint=3Dlon= g -Og -S -Wall pr90710.c) + cat pr90710.c static inline int f (int x, int *p) { if (x =3D=3D 0) return 0; *p =3D x; return 1; } volatile int z; void g (int x) { int b, a =3D f (x, &b); if (a) z =3D b; if (__builtin_expect (a, 1)) z =3D b; } + gcc -Og -S -Wall pr90710.c pr90710.c: In function =E2=80=98g=E2=80=99: pr90710.c:20:7: warning: =E2=80=98b=E2=80=99 may be used uninitialized in t= his function [-Wmaybe-uninitialized] 20 | z =3D b; | ~~^~~ pr90710.c:14:7: note: =E2=80=98b=E2=80=99 was declared here 14 | int b, a =3D f (x, &b); | ^ + gcc -Dint=3Dlong -Og -S -Wall pr90710.c=