It seems to me that there's a small issue in mergecil.ml related to
merging a global definition with a previously seen tentative definition
(i.e. with an init set to None), in oneFilePass2. Namely, the new
definition is kept, but the actual initializer is not placed in
emittedVarDefn. Thus, if we ever encounter a third definition different
from the second, the clash won't be noticed. This can be seen with
three files containing int x; int x = 2; and int x = 3; respectively.
cilly --save-temps --merge first_def.c second_def.c third_def.c will
then produce a uncompilable C file in a.cil.c containing the two
The attached patch (against cil 1.3.7) takes care of that, and gets rid
of the comment saying that the old tentative definition ought to be
replaced by a GVarDecl by actually doing it.
(Disclaimer: this implies a traversal of the whole list of globals.
I've used a List.rev (List.map_rev ...), i.e. two traversals, but
tail-recursive, to avoid blowing up the stack, but this is untested for
E tutto per oggi, a la prossima volta.
Get latest updates about Open Source Projects, Conferences and News.