https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98970

            Bug ID: 98970
           Summary: Use of uninitialized variable in loop is not reported
           Product: gcc
           Version: 10.2.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: aa1ronham at gmail dot com
  Target Milestone: ---

The following code:

```
int main() {
    int x;
    for (int i = 0; i < 10; i++) {
        x++;
    }
}
```

does not produce any warnings when compiled with 'g++ bad.cpp -Wall'

However, the increment 'x++' reads an uninitialized value of 'x', so a warning
should be reported.

Reply via email to