Skip to content
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

Open
vicuna opened this Issue Jul 24, 2018 · 3 comments

Comments

Projects
None yet
1 participant
@vicuna
Copy link
Collaborator

vicuna commented Jul 24, 2018

Original bug ID: 7829
Reporter: db
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.

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Jul 24, 2018

Comment author: db

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.

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Jul 24, 2018

Comment author: @dra27

See discussion in #1311

@vicuna

This comment has been minimized.

Copy link
Collaborator Author

vicuna commented Jul 29, 2018

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.

@vicuna vicuna added this to the 4.08.0 milestone Mar 14, 2019

@vicuna vicuna added the bug label Mar 20, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.