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.
Function definitions
GFun
share thevarinfo
with all of its declarations (GVar
/GVarDecl
). Within a single file, Cabs2cil prefers the definition's location for the function variable: https://github.com/goblint/cil/blob/986a509d85417a55b4c98e635e3d52abb7e85b3f/src/frontc/cabs2cil.ml#L1939-L1942Turns 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.