public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "msebor at gcc dot gnu.org" <gcc-bugzilla@gcc.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 [thread overview] Message-ID: <bug-90710-4-Yk0ETvSBOl@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-90710-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=90710 --- Comment #4 from Martin Sebor <msebor at gcc dot gnu.org> --- 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=long -Og -S -Wall pr90710.c) + cat pr90710.c static inline int f (int x, int *p) { if (x == 0) return 0; *p = x; return 1; } volatile int z; void g (int x) { int b, a = f (x, &b); if (a) z = b; if (__builtin_expect (a, 1)) z = b; } + gcc -Og -S -Wall pr90710.c pr90710.c: In function ‘g’: pr90710.c:20:7: warning: ‘b’ may be used uninitialized in this function [-Wmaybe-uninitialized] 20 | z = b; | ~~^~~ pr90710.c:14:7: note: ‘b’ was declared here 14 | int b, a = f (x, &b); | ^ + gcc -Dint=long -Og -S -Wall pr90710.c
prev parent reply other threads:[~2021-04-06 23:16 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-90710-4@http.gcc.gnu.org/bugzilla/> 2021-04-06 23:13 ` msebor at gcc dot gnu.org 2021-04-06 23:16 ` msebor at gcc dot gnu.org [this message]
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-90710-4-Yk0ETvSBOl@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).