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

            Bug ID: 97353
           Summary: -Wuninitialized should warn about reading condition in
                    do-loop
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
          Assignee: unassigned at gcc dot gnu.org
          Reporter: mpolacek at gcc dot gnu.org
  Target Milestone: ---

Here in the first iteration of the loop we continue, which jumps to the end of
the loop where we read ok which hasn't yet been initialized, but we issue no
warning:

int main()
{
  int ok;
  int n = 0;
  do
    {
      n++;
      if (n == 1)
        continue;
      ok = n >= 2;
    }
  while (ok == 0);
}

clang-tidy detects this.  This was distilled from libmpc.

Reply via email to