The error recovery of the C parser sometimes gets confused. The following testcase contains three bugs:
void foo() { +; +; } int +; But the C frontend only reports the first one: bug.c: In function 'foo': bug.c:3: error: expected expression before ';' token The old yacc-based parser reported two bugs, so this is a regression. bug.c: In function 'foo': bug.c:3: error: parse error before ';' token bug.c: At top level: bug.c:7: error: parse error before '+' token The C++ frontend reports all, btw.: bug.cc: In function 'void foo()': bug.cc:3: error: expected primary-expression before ';' token bug.cc:4: error: expected primary-expression before ';' token bug.cc: At global scope: bug.cc:7: error: expected unqualified-id before '+' token In other situations we get bogus error messages, e.g.: void foo() { +; } int i; void bar() { i++; } bug.c: In function 'foo': bug.c:1: error: expected expression before ';' token bug.c: In function 'bar': bug.c:3: error: 'i' undeclared (first use in this function) bug.c:3: error: (Each undeclared identifier is reported only once bug.c:3: error: for each function it appears in.) Posting a patch soon. -- Summary: [4.1/4.2 regression] Poor error recovery of C parser Product: gcc Version: 4.2.0 Status: UNCONFIRMED Keywords: diagnostic, monitored Severity: normal Priority: P3 Component: c AssignedTo: reichelt at gcc dot gnu dot org ReportedBy: reichelt at gcc dot gnu dot org http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28649