-
Notifications
You must be signed in to change notification settings - Fork 20
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
Fix merging and renaming of inlines #124
Conversation
That means if only a single file containing |
No, that is not the case. Renaming here means, it finds a new name (e.g. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apart from my small comments above, this looks good to me!
LGTM! |
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.
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.
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:
matchVarinfo
is 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 singlevarinfo
for it. For inline functions that have internal linkage only, we instead callgetNode
.Closes #120