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

Replace int -> _Bool in goblint stubs arguments #1684

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open

Conversation

sim642
Copy link
Member

@sim642 sim642 commented Feb 17, 2025

Follow-up on #1682 (comment).

The replacement is straightforward but many tests seem to have failed, so this change is not as easy as it seemed.

TODO

  • Are there pre-C11 compatibility issues?
  • Fix all tests.
  • Less hacky removal of _Bool casts? Try in LibraryFunctions.

Based on 00-sanity/01-assert.
Related to #1682 (comment).
This matters when applied directly to pointers: #1682 (comment).
@sim642
Copy link
Member Author

sim642 commented Feb 18, 2025

Doing the _Bool cast stripping in LibraryFunctions doesn't completely work: EvalInt query on non-integers (like pointers) returns Bot to indicate the type mismatch instead of forcing it to an integer.

Having the assert analysis query with the cast added back (but not printed) seems to fix the issue, but I don't know of good of an idea that is.
The tests don't reveal this, but some analyses answer the EvalInt query by pattern matching on some binary expression. This no longer matches if there's a cast slapped in front.

One possibility to having Queries.eval_bool only add the cast for non-integer expressions (so binary comparisons don't get one). On the other hand, this makes things less consistent.
It also brings up the question whose responsibility it is to guarantee/handle/check what: the query asker or the query answerer.

@sim642 sim642 marked this pull request as ready for review February 19, 2025 08:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant