public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jwzeng at nuaa dot edu.cn" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug middle-end/110761] New: No warning for an uninitialized variable when used within its own initialization Date: Fri, 21 Jul 2023 08:04:22 +0000 [thread overview] Message-ID: <bug-110761-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110761 Bug ID: 110761 Summary: No warning for an uninitialized variable when used within its own initialization Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: middle-end Assignee: unassigned at gcc dot gnu.org Reporter: jwzeng at nuaa dot edu.cn Target Milestone: --- Link to the Compiler Explorer: https://godbolt.org/z/ra7P3EcMn There is no warning for a variable is uninitialized when used within its own initialization. $ cat test.c int main(void) { int a = 1, b = 2; int g = (a % ((~0) && b)) && g; } $ gcc-trunk -Wall -Wextra -pedantic -c test.c $ $ clang-16.0.0 -Weverything -pedantic -c test.c test.c:4:34: warning: variable 'g' is uninitialized when used within its own initialization [-Wuninitialized] int g = (a % ((~0) && b)) && g; ~ ^ 1 warning generated. $ $ gcc-trunk -v gcc (GCC) 14.0.0 20230619 (experimental) [master r14-1917-gf8e0270272] $ clang-16.0.0 -v clang version 16.0.0 Target: x86_64-unknown-linux-gnu Would it be better to output warning information like clang? In gcc-11.4 and earlier versions, there will be corresponding warnings.
next reply other threads:[~2023-07-21 8:04 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2023-07-21 8:04 jwzeng at nuaa dot edu.cn [this message] 2023-07-21 9:34 ` [Bug middle-end/110761] " rguenth at gcc dot gnu.org
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-110761-4@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).