It is not that simple - making compare in limes 463 & 464 unsigned does not actually fix the problem, just moves it to line 464. Can someone who is familiar with GC internals comment on this? Is signed compare really expected here? What could I do to further debug the problem? It only happens when I build OCaml internally inside a docker container, standard github/travis CI tests do not trigger it. And only x86 build is affected, x64 one works as expected.

Similar wrong assertions were fixed in https://github.com/ocaml/ocaml/pull/1483 [^] but other remain, as shown here. It looks like pointer types should be used instead of signed integer types, at least for the comparisons, perhaps even for the "prev" and "bp" variables.