-
Notifications
You must be signed in to change notification settings - Fork 22
Description
While looking into how to parse single expressions, e.g. coming from a witness, I noticed how Goblint abuses Formatcil.cExp for that. Despite not being intended for user input parsing, it cannot parse logical operators:
-
glob == 0 || glob == 1doesn't parse at all. -
glob == 1 && i == 11parses, but even more confusingly returns an incorrect AST:&(==(Lval(Var(glob, NoOffset)), Const(Int(1,int,1))),==(AddrOf(Var(i, NoOffset)), Const(Int(11,int,11)))). Since it doesn't recognize&&as a token, this expression is parsed instead asglob == 1 &(& i == 11)(with a bitwise and, and address of).This misparsing is very confusing because instead of immediate problems, it crashes Goblint in surprising ways:
exception IntDomain.IncompatibleIKinds("ikinds int and unsigned long are incompatible. Values: (1) and (1)").
The use of Formatcil.cExp for semantic search in Goblint is quite liberal with the use of catch-all try blocks, which quietly hides both problems.