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

            Bug ID: 107162
           Summary: -Wmisleading-indentation is blinded by comments
           Product: gcc
           Version: 12.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kees at outflux dot net
  Target Milestone: ---

Hi,

Similar to this bug:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106528

-Wmissing-indentation is blinded by comments:

int square(int num) {
    if (num == 1)
        goto fail;

//    if (num == 0)
        goto fail;

    if (num > 20)
        return num * num;
    else
        return num + num;

fail:
    return -1;
}

The above case does not warn in GCC, but does in Clang:
https://godbolt.org/z/bMG5jM9Ga

Reply via email to