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 analyzer/103658] missing -Wanalyzer-use-of-uninitialized-value at -O1 and below for an array access Date: Fri, 10 Dec 2021 21:46:17 +0000 [thread overview] Message-ID: <bug-103658-4-4OpsYeaa34@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-103658-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=103658 --- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> --- Actually, what I was really after is trying to see if the analyzer would print the conditionals involved in the subscript expressions. But in the simple test case in comment #0 there are no conditionals. They are here: int f (int i, int j) { int a[3]; a[0] = 1; a[1] = 2; if (i < 1 || 3 < i) i = 1; if (j < 1 || 5 < j) j = 1; return a[i + j]; } but it doesn't print them even at -O2 when it does warn: z.c: In function ‘f’: z.c:9:11: warning: use of uninitialized value ‘a[<unknown>]’ [CWE-457] [-Wanalyzer-use-of-uninitialized-value] 9 | return a[i + j]; | ~^~~~~~~ ‘f’: event 1 | | 9 | return a[i + j]; | | ~^~~~~~~ | | | | | (1) use of uninitialized value ‘a[<unknown>]’ here |
next prev parent reply other threads:[~2021-12-10 21:46 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-12-10 21:30 [Bug analyzer/103658] New: " msebor at gcc dot gnu.org 2021-12-10 21:46 ` msebor at gcc dot gnu.org [this message] 2022-02-09 20:59 ` [Bug analyzer/103658] " dmalcolm at gcc dot gnu.org 2022-02-09 21:12 ` dmalcolm 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-103658-4-4OpsYeaa34@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).