Fix merging and renaming of inlines#124
Merged
Conversation
1 task
sim642
reviewed
Nov 16, 2022
Member
That means if only a single file containing |
Member
Author
No, that is not the case. Renaming here means, it finds a new name (e.g. |
michael-schwarz
approved these changes
Nov 22, 2022
Member
michael-schwarz
left a comment
There was a problem hiding this comment.
Apart from my small comments above, this looks good to me!
Member
|
LGTM! |
jerhard
approved these changes
Nov 23, 2022
sim642
added a commit
to sim642/opam-repository
that referenced
this pull request
Sep 11, 2023
CHANGES: * Rename `Rmtmps` to `RmUnused` (goblint/cil#135). * Add option to add return statement to `noreturn` functions (goblint/cil#129). * Fix empty `if`s being removed (goblint/cil#140). * Fix `_Float128` support (goblint/cil#118, goblint/cil#119). * Fix C11 `_Alignas` computation (goblint/cil#130). * Fix renaming and merging of `inline` functions based on C standard (goblint/cil#120, goblint/cil#124). * Fix `Pretty` not resetting all global state between calls (goblint/cil#133, goblint/cil#134). * Fix `fundec` location in merger (goblint/cil#139). * Fix `cilly` patcher (goblint/cil#128). * Disable basename by default in parser.
nberth
pushed a commit
to nberth/opam-repository
that referenced
this pull request
Jun 18, 2024
CHANGES: * Rename `Rmtmps` to `RmUnused` (goblint/cil#135). * Add option to add return statement to `noreturn` functions (goblint/cil#129). * Fix empty `if`s being removed (goblint/cil#140). * Fix `_Float128` support (goblint/cil#118, goblint/cil#119). * Fix C11 `_Alignas` computation (goblint/cil#130). * Fix renaming and merging of `inline` functions based on C standard (goblint/cil#120, goblint/cil#124). * Fix `Pretty` not resetting all global state between calls (goblint/cil#133, goblint/cil#134). * Fix `fundec` location in merger (goblint/cil#139). * Fix `cilly` patcher (goblint/cil#128). * Disable basename by default in parser.
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.
The renaming of inline functions was broken in that multiple functions with the same name were outputted in the merged CIL file. This also lead to difficulties with the incremental analysis in Goblint, because globals are expected to have a unique name (goblint/analyzer#836). Also, the merging of inline functions was not correct, because inline functions with different bodies would not be renamed and the wrong version of a function would be called.
This PR aims at fixing that. For this, a distinction is made which C Standard is used, i.e. whether the gnu89 or c99 inline semantics needs to be used. They differ in that for c99 inline functions have internal linkage by default, unless extern inline is used, whereas it is opposite for gnu89. They agree on static inline functions that can in both cases only be called from the same translation unit.
This is reflected in the following changes:
matchVarinfois only called for functions that can be called from other translation units. It assumes that the respective global has a unique name and aligns multiple occurrences (for example declarations) and creates a singlevarinfofor it. For inline functions that have internal linkage only, we instead callgetNode.Closes #120