The following program (forinit.c):
void f() {
for (int i = 0; i < 5; i++)
;
}
causes splint to give the error:
forinit.c:2:13: Parse Error. (For help on parse errors, see splint -help
parseerrors.)
*** Cannot continue.
This occurs with splint 3.1.2 and the version in CVS.
Here is a patch for cgrammar.y that fixes the parse error:
1748a1749,1753
> | CFOR TLPAREN completeTypeSpecifier optExpr TSEMI optExpr TSEMI
> { context_setProtectVars (); } optExpr { context_sizeofReleaseVars (); }
> TRPAREN
> { $$ = exprNode_forPred ($4, $6, $9);
> context_enterForClause ($6); }
But this causes the variable i to be considered undeclared in the above code.