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
Assertion failed in freelist.c #7829
Comments
Comment author: @db4 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. |
Comment author: @xavierleroy Similar wrong assertions were fixed in #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. |
Original bug ID: 7829
Reporter: @db4
Status: acknowledged (set by @dra27 on 2018-07-24T11:17:41Z)
Resolution: open
Priority: high
Severity: crash
Platform: i386
OS: Linux
Version: 4.07.0
Target version: 4.08.0+dev/beta1/beta2
Category: runtime system and C interface
Related to: #7831
Monitored by: @nojb @gasche
Bug description
When running the testsuite with the debug runtime inside docker container I'm getting many errors like this:
Running tests from 'tests/runtime-errors' ...
file freelist.c; line 463 ### Assertion failed: prev < bp || prev == Fl_head
Aborted (core dumped)
I tried to debug the problem and added
if (!(prev < bp || prev == Fl_head)) {
fprintf (stderr, "%lx %lx %lx\n", prev, bp, Fl_head);
}
before line 463. That gave me
58476004 f731b4cc 56dfd5a4
So the bug is obvious now. prev and bp are values (i.e. signed ints) so compiler uses signed compare here. But we would like to compare prev and bp as pointers that are unsigned addresses.
The fix for this problem is trivial but I'm afraid it's not the only place where signed compare is incorrectly used for pointers.
The text was updated successfully, but these errors were encountered: