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

Reply via email to