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 c/44677] Warn for variables incremented but not used Date: Tue, 19 May 2020 17:23:03 +0000 [thread overview] Message-ID: <bug-44677-4-pN4RS56rOt@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-44677-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=44677 Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed|2010-06-28 00:34:58 |2020-5-19 --- Comment #10 from Martin Sebor <msebor at gcc dot gnu.org> --- See pr95217 for other cases to handle (-Wunused-but-set-parameter). For the test case there, Clang's static analyzer diagnoses two out of the four cases: $ cat pr95217.c && clang -S -Wall -Wextra --analyze pr95217.c void f0 (int *p) { p = 0; // -Wunused-but-set-parameter (expected) } void f1 (int *p) { p += 1; // missing warning } void f2 (int *p) { p = p + 1; // missing warning } void f3 (int *p) { ++p; // missing warning } pr95217.c:8:3: warning: Value stored to 'p' is never read p += 1; // missing warning ^ ~ pr95217.c:13:3: warning: Value stored to 'p' is never read p = p + 1; // missing warning ^ ~~~~~ 2 warnings generated.
next parent reply other threads:[~2020-05-19 17:23 UTC|newest] Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-44677-4@http.gcc.gnu.org/bugzilla/> 2020-05-19 17:23 ` msebor at gcc dot gnu.org [this message] 2021-04-21 17:41 ` jsm28 at gcc dot gnu.org 2021-10-24 6:09 ` pinskia at gcc dot gnu.org 2022-04-09 0:48 ` eggert at cs dot ucla.edu 2022-09-19 10:03 ` stormbyte at gmail dot com 2022-12-17 17:58 ` pinskia at gcc dot gnu.org 2022-12-17 18:04 ` [Bug c/44677] Warn for variables incremented but not used (+=, ++) pinskia at gcc dot gnu.org 2023-07-18 22:59 ` vincent-gcc at vinc17 dot net 2010-06-26 0:53 [Bug c/44677] New: Warn for variables incremented but not used jsm28 at gcc dot gnu dot org 2010-06-28 0:35 ` [Bug c/44677] " pinskia at gcc dot gnu dot 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-44677-4-pN4RS56rOt@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).