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

Preserve fundec location in merger #139

Merged
merged 1 commit into from
Apr 14, 2023
Merged

Preserve fundec location in merger #139

merged 1 commit into from
Apr 14, 2023

Conversation

sim642
Copy link
Member

@sim642 sim642 commented Apr 13, 2023

Function definitions GFun share the varinfo with all of its declarations (GVar/GVarDecl).
Within a single file, Cabs2cil prefers the definition's location for the function variable:

cil/src/frontc/cabs2cil.ml

Lines 1939 to 1942 in 986a509

(* Found an old one. Keep the location always from the definition *)
if isadef then begin
oldvi.vdecl <- vi.vdecl;
end;

Turns out that Mergecil doesn't and simply keeps the first one. So depending on the order of merged files, it may be given a declaration's location from a header, even though a definition exists in another file.
For consistency definition locations should also be preferred during merging.

@sim642 sim642 added the bug label Apr 13, 2023
@sim642 sim642 added this to the 2.0.2 milestone Apr 13, 2023
@michael-schwarz michael-schwarz self-requested a review April 14, 2023 07:23
@sim642 sim642 merged commit 4df989f into develop Apr 14, 2023
@sim642 sim642 deleted the merge-fundec-loc branch April 14, 2023 10:47
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants