Rename functions with gnu_inline attribute when inline merging is off#85
Rename functions with gnu_inline attribute when inline merging is off#85michael-schwarz merged 2 commits intodevelopfrom
gnu_inline attribute when inline merging is off#85Conversation
gnu_inline attribute if inline merging turned off
gnu_inline attribute if inline merging turned offgnu_inline attribute when inline merging is off
| else begin | ||
| (* Maybe it is static. Rename it then *) | ||
| if vi.vstorage = Static then begin | ||
| if vi.vstorage = Static || (not !merge_inlines && hasAttribute "gnu_inline" (typeAttrs vi.vtype)) then begin |
There was a problem hiding this comment.
I'm a bit confused why this fix is here, instead of where all the other no-merge_inlines code is:
Lines 1549 to 1586 in d07f7db
There was a problem hiding this comment.
None of that code deals with inlines though (not fdec'.svar.vinline), and it makes sense to treat these functions as if they were static when the gnu_inline attribute is set.
There was a problem hiding this comment.
The code I linked is in the else branch of the actual inlines merging. And the else branch of this at the very end is where everything else is considered, so it seems to me like the fix should be there.
The bigger issue with it being in processVarinfo is related to #84 (where variables get merged, but functions don't), just in the other direction (here we avoid merging variables with __gnu_inline__, but the renaming is distinct from the merging itself). The logic of whether to merge or not is duplicated and different between processVarinfo and below, where I linked, and this is just deepening the difference. It's not helping anything to avoid inconsistencies.
Bump goblint-cil (goblint/cil#85)
CHANGES: * Wrap library into `GoblintCil` module (goblint/cil#107). * Remove all MSVC support (goblint/cil#52, goblint/cil#88). * Port entire build process from configure/make to dune (goblint/cil#104). * Add C11 `_Generic` support (goblint/cil#48). * Add C11 `_Noreturn` support (goblint/cil#58). * Add C11 `_Static_assert` support (goblint/cil#62). * Add C11 `_Alignof` support (goblint/cil#66). * Add C11 `_Alignas` support (goblint/cil#93, goblint/cil#108). * Add partial C11 `_Atomic` support (goblint/cil#61). * Add `_Float32`, `_Float64`, `_Float32x` and `_Float64x` type support (goblint/cil#8, goblint/cil#60). * Add Universal Character Names, `char16_t` and `char32_t` type support (goblint/cil#80). * Change locations to location spans and add additional expression locations (goblint/cil#51). * Add synthetic marking for CIL-inserted statement locations (goblint/cil#98). * Expose list of files from line control directives (goblint/cil#73). * Add parsed location transformation hook (goblint/cil#89). * Use Zarith for integer constants (goblint/cil#47, goblint/cil#53). * Fix constant folding overflows (goblint/cil#59). * Add option to disable constant branch removal (goblint/cil#103). * Add standalone expression parsing and checking (goblint/cil#97, goblint/cil#96). * Improve inline function merging (goblint/cil#72, goblint/cil#85, goblint/cil#84, goblint/cil#86). * Fix some attribute parsing cases (goblint/cil#71, goblint/cil#75, goblint/cil#76, goblint/cil#77). * Fix global NaN initializers (goblint/cil#78, goblint/cil#79). * Fix `cilly` binary installation (goblint/cil#99, goblint/cil#100, goblint/cil#102). * Remove batteries dependency to support OCaml 5 (goblint/cil#106).
CHANGES: * Wrap library into `GoblintCil` module (goblint/cil#107). * Remove all MSVC support (goblint/cil#52, goblint/cil#88). * Port entire build process from configure/make to dune (goblint/cil#104). * Add C11 `_Generic` support (goblint/cil#48). * Add C11 `_Noreturn` support (goblint/cil#58). * Add C11 `_Static_assert` support (goblint/cil#62). * Add C11 `_Alignof` support (goblint/cil#66). * Add C11 `_Alignas` support (goblint/cil#93, goblint/cil#108). * Add partial C11 `_Atomic` support (goblint/cil#61). * Add `_Float32`, `_Float64`, `_Float32x` and `_Float64x` type support (goblint/cil#8, goblint/cil#60). * Add Universal Character Names, `char16_t` and `char32_t` type support (goblint/cil#80). * Change locations to location spans and add additional expression locations (goblint/cil#51). * Add synthetic marking for CIL-inserted statement locations (goblint/cil#98). * Expose list of files from line control directives (goblint/cil#73). * Add parsed location transformation hook (goblint/cil#89). * Use Zarith for integer constants (goblint/cil#47, goblint/cil#53). * Fix constant folding overflows (goblint/cil#59). * Add option to disable constant branch removal (goblint/cil#103). * Add standalone expression parsing and checking (goblint/cil#97, goblint/cil#96). * Improve inline function merging (goblint/cil#72, goblint/cil#85, goblint/cil#84, goblint/cil#86). * Fix some attribute parsing cases (goblint/cil#71, goblint/cil#75, goblint/cil#76, goblint/cil#77). * Fix global NaN initializers (goblint/cil#78, goblint/cil#79). * Fix `cilly` binary installation (goblint/cil#99, goblint/cil#100, goblint/cil#102). * Remove batteries dependency to support OCaml 5 (goblint/cil#106).
With gcc 4.3 the semantic of extern inline was changed to conform with the ISO C99 standard (https://gcc.gnu.org/gcc-4.3/porting_to.html). Functions that should still have the GNU extern inline behavior have the attribute
__attribute__((__gnu_inline__)). A function with this attribute in a header that is included in multiple different translation units leads to multiple function variables with the same name. This violates the check that was added with goblint/analyzer@39d7288. By renaming function variables, that have thisgnu_inlineattribute, whenever inline functions are not merged, fixes this. Below is an example where the problem can be observed:./goblint --enable incremental.save --disable incremental.load file1.c file2.c./goblint --disable incremental.save --enable incremental.load file1.c file2.cor alternatively using
--set pre.cppflags[+] -fgnu89-inlineinstead of the__attribute__((__gnu_inline__))in the function definition