public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "mail at milianw dot de" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug analyzer/100705] New: warn about dead store Date: Thu, 20 May 2021 14:09:20 +0000 [thread overview] Message-ID: <bug-100705-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100705 Bug ID: 100705 Summary: warn about dead store Product: gcc Version: 11.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: analyzer Assignee: dmalcolm at gcc dot gnu.org Reporter: mail at milianw dot de Target Milestone: --- Hey there, in a large code base I'm working on I stumbled over code in one area that basically did the below, but in a more elaborate manner. It would have been quite helpful to get a warning when `-fanalyzer` is passed, because in my opinion, this code is bogus: ``` struct Properties { int foo = 0; int bar = 0; }; Properties asdf() { Properties ret; ret.foo = 42; // warning: this has no effect ret.bar = 1; ret.foo = 12; // b/c it's unconditionally overwritten here return ret; } ``` Thanks
next reply other threads:[~2021-05-20 14:09 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-05-20 14:09 mail at milianw dot de [this message] 2021-05-20 21:11 ` [Bug analyzer/100705] RFE: " dmalcolm at gcc dot gnu.org 2021-05-21 14:20 ` egallager at gcc dot gnu.org 2022-11-23 19:18 ` 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-100705-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).