https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70954
Bug ID: 70954 Summary: -Wmisleading-indentation false positive on GNU "ed" Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: dmalcolm at gcc dot gnu.org Target Milestone: --- A user reported a false positive with -Wmisleading-indentation when compiling "ed" with gcc 6.1: https://gcc.gnu.org/ml/gcc/2016-05/msg00044.html Minimal reproducer: void test (const char ** const ibufpp) { int c = *(*ibufpp)++; switch (c) { case '#': while( *(*ibufpp)++ != '\n' ) ; break; } } $ ./xgcc -B. -c test.c -Wall test.c: In function ‘test’: test.c:6:15: warning: this ‘while’ clause does not guard... [-Wmisleading-indentation] case '#': while( *(*ibufpp)++ != '\n' ) ; ^~~~~ test.c:7:15: note: ...this statement, but the latter is misleadingly indented as if it is guarded by the ‘while’ break; ^~~~~ I agree that this is a false positive. With trunk r235889 (and presumably the gcc-6-branch), we currently exit from should_warn_for_misleading_indentation here: 495 /* Otherwise, they are visually aligned: issue a warning. */ 496 return true;