From 7364f5081851fe306802883d9a8069da559d4973 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Tue, 4 Aug 2020 12:26:12 +0100 Subject: [PATCH 8/8] runtime/major_gc.c: Declare caml_fl_merge with proper type. When compiling OCaml with LTO enabled (as is now done routinely in Fedora and OpenSUSE) we got a failure because the caml_fl_merge symbol is not declared identically across compilation units. The simple fix is to make sure the declarations are identical, although probably moving the definition to a common header file would be a better long-term fix. major_gc.c:66:14: warning: type of 'caml_fl_merge' does not match original declaration [-Wlto-type-mismatch] 66 | extern char *caml_fl_merge; /* Defined in freelist.c. */ | ^ freelist.c:47:7: note: 'caml_fl_merge' was previously declared here 47 | value caml_fl_merge = Val_NULL; /* Current insertion pointer. Managed | ^ freelist.c:47:7: note: code may be misoptimized unless '-fno-strict-aliasing' is used --- runtime/major_gc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/major_gc.c b/runtime/major_gc.c index 5e4f06bce..c8f5a3281 100644 --- a/runtime/major_gc.c +++ b/runtime/major_gc.c @@ -63,7 +63,7 @@ uintnat caml_dependent_size, caml_dependent_allocated; double caml_extra_heap_resources; uintnat caml_fl_wsz_at_phase_change = 0; -extern char *caml_fl_merge; /* Defined in freelist.c. */ +extern value caml_fl_merge; /* Defined in freelist.c. */ static char *markhp, *chunk, *limit; static double p_backlog = 0.0; /* backlog for the gc speedup parameter */ @@ -570,7 +570,7 @@ static void sweep_slice (intnat work) break; case Caml_blue: /* Only the blocks of the free-list are blue. See [freelist.c]. */ - caml_fl_merge = Bp_hp (hp); + caml_fl_merge = (value) Bp_hp (hp); break; default: /* gray or black */ CAMLassert (Color_hd (hd) == Caml_black); -- 2.28.0.rc2