Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0007829OCamlruntime system and C interfacepublic2018-07-24 10:372018-07-29 17:58
Assigned To 
Platformi386OSLinuxOS Version
Product Version4.07.0 
Target Version4.08.0+devFixed in Version 
Summary0007829: Assertion failed in freelist.c
DescriptionWhen 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.

TagsNo tags attached.
Attached Files

- Relationships
related to 0007831acknowledged Assertion failed in gc_ctrl.c 

-  Notes
db (reporter)
2018-07-24 12:37

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.
dra (developer)
2018-07-24 13:17

See discussion in [^]
xleroy (administrator)
2018-07-29 17:54

Similar wrong assertions were fixed in [^] 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.

- Issue History
Date Modified Username Field Change
2018-07-24 10:37 db New Issue
2018-07-24 11:42 frisch Target Version => 4.08.0+dev
2018-07-24 12:37 db Note Added: 0019268
2018-07-24 13:17 dra Note Added: 0019269
2018-07-24 13:17 dra Status new => acknowledged
2018-07-29 17:54 xleroy Note Added: 0019279
2018-07-29 17:58 xleroy Relationship added related to 0007831

Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker