Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formatcil doesn't support || and && operators #94

Open
sim642 opened this issue May 24, 2022 · 0 comments
Open

Formatcil doesn't support || and && operators #94

sim642 opened this issue May 24, 2022 · 0 comments
Labels

Comments

@sim642
Copy link
Member

sim642 commented May 24, 2022

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 == 1 doesn't parse at all.

  • glob == 1 && i == 11 parses, 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 as glob == 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant