Add attribute goblint_cil_nested to local varinfos that are not declared at top scope#155
Merged
michael-schwarz merged 4 commits intodevelopfrom Oct 2, 2023
Merged
Add attribute goblint_cil_nested to local varinfos that are not declared at top scope#155michael-schwarz merged 4 commits intodevelopfrom
goblint_cil_nested to local varinfos that are not declared at top scope#155michael-schwarz merged 4 commits intodevelopfrom
Conversation
sim642
approved these changes
Oct 2, 2023
1 task
sim642
added a commit
to sim642/opam-repository
that referenced
this pull request
Nov 20, 2023
CHANGES: * Add `asm inline` parsing (goblint/cil#151). * Ignore top level qualifiers in `__builtin_types_compatible_p` (goblint/cil#157). * Add attribute `goblint_cil_nested` to local variables in inner scopes (goblint/cil#155). * Expose `Cil.typeSigAddAttrs`. * Add option to suppress `long double` warnings (goblint/cil#136, goblint/cil#156). * Fix syntactic search (goblint/cil#147).
nberth
pushed a commit
to nberth/opam-repository
that referenced
this pull request
Jun 18, 2024
CHANGES: * Add `asm inline` parsing (goblint/cil#151). * Ignore top level qualifiers in `__builtin_types_compatible_p` (goblint/cil#157). * Add attribute `goblint_cil_nested` to local variables in inner scopes (goblint/cil#155). * Expose `Cil.typeSigAddAttrs`. * Add option to suppress `long double` warnings (goblint/cil#136, goblint/cil#156). * Fix syntactic search (goblint/cil#147).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
CIL pulls up all declarations inside a function to the top-level scope of that function. This transformation turns code that has Undefined Behavior into code without any UB, which is of course perfectly ok for a compiler to do, but bad for tools who want to flag this type of UB despite working on the output of CIL.
An example of this is the following snippet:
After CIL,
jis pulled to the top scope and there is no more UB.A rewrite to properly handle scopes seems tedious, and also of questionable value, since it would be a breaking change and would make using CIL more complicated.
This adds an option
addNestedScopeAttrtocabs2cil. When it is enabled, this adds an attributegoblint_cil_nestedto allvarinfosfor locals that occur inside a nested scope. This way, sound tools can overapproximate for which variables there may be issues.As the flag is off by default, this should not cause any changes in behavior for other users.
c.f. goblint/analyzer#1199