https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106528
Bug ID: 106528
Summary: Double semi-colon causes -Wmisleading-identation to
not emit warning
Product: gcc
Version: 12.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
Assignee: unassigned at gcc dot gnu.org
Reporter: baker.dylan.c at gmail dot com
Target Milestone: ---
A double semi-colon will cause the misleading-indentation warning to miss that
a second indented statement is not part by the condiational block.
#include <stdio.h>
int main(void) {
if (1)
printf("%s", "true);;
return 0;
return 1;
Removing the extranious semi-colon from the printf() call will correct the
problem and gcc will emit a warning as expected.
I've tested with 11.3.1 and 12.1.0, and with clang 14, which has the same
behavior. This was noticed through a macro that adds a semi-colon in the macro
definition, and then has a semi-colon following the call to the macro.