public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug analyzer/100705] New: warn about dead store
@ 2021-05-20 14:09 mail at milianw dot de
2021-05-20 21:11 ` [Bug analyzer/100705] RFE: " dmalcolm at gcc dot gnu.org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: mail at milianw dot de @ 2021-05-20 14:09 UTC (permalink / raw)
To: gcc-bugs
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug analyzer/100705] RFE: warn about dead store
2021-05-20 14:09 [Bug analyzer/100705] New: warn about dead store mail at milianw dot de
@ 2021-05-20 21:11 ` 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
2 siblings, 0 replies; 4+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2021-05-20 21:11 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100705
David Malcolm <dmalcolm at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Summary|warn about dead store |RFE: warn about dead store
--- Comment #1 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
Thanks for filing this RFE.
Some notes:
"CWE-563: Assignment to Variable without Use":
https://cwe.mitre.org/data/definitions/563.html
PVS-Studio implements this as V-519:
https://pvs-studio.com/en/docs/warnings/v519/
https://pvs-studio.com/en/blog/examples/v519/
(lots of examples at that link)
I'm not sure how well this ties into what the analyzer is already doing,
though.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug analyzer/100705] RFE: warn about dead store
2021-05-20 14:09 [Bug analyzer/100705] New: warn about dead store mail at milianw dot de
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
2 siblings, 0 replies; 4+ messages in thread
From: egallager at gcc dot gnu.org @ 2021-05-21 14:20 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100705
Eric Gallager <egallager at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |egallager at gcc dot gnu.org
Keywords| |diagnostic
--- Comment #2 from Eric Gallager <egallager at gcc dot gnu.org> ---
I think there's another bug open for this, but I can't find it at the moment...
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug analyzer/100705] RFE: warn about dead store
2021-05-20 14:09 [Bug analyzer/100705] New: warn about dead store mail at milianw dot de
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
2 siblings, 0 replies; 4+ messages in thread
From: dmalcolm at gcc dot gnu.org @ 2022-11-23 19:18 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100705
--- Comment #3 from David Malcolm <dmalcolm at gcc dot gnu.org> ---
See also: PR 80066
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-11-23 19:18 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-20 14:09 [Bug analyzer/100705] New: warn about dead store mail at milianw dot de
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
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).