You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Original bug ID: 4343 Reporter: daweil Status: closed (set by @xavierleroy on 2007-10-25T09:02:08Z) Resolution: won't fix Priority: normal Severity: crash Version: 3.10.0 Category: runtime system and C interface
Bug description
Why do this program crash ?
This small program call a CAML function which does nothing but do "raise Exit" from C.
Before the call to CAMLreturn, a call to another CAML function which compact the GC is triggered.
The program crash if the function caml_callback_exn is raised instead of caml_callback.
The correction I found was to write "caml_local_roots = caml_frame" before calling the second CAML function.
Is a bug in the CAML compiler or a bug in the documentation of the C/CAML writing rules ?
Daniel Weil
Additional information
To reproduce the bug, unzip the file src.zip
Type "make", the "make run".
The makefile is for Windows, but I suspect the bug to be reproductible on other OS also.
The value returned by caml_callbackN_exn should not be registered as a GC root, as it is not a well-formed value in the case where an exception is returned.
In other terms, consider:
x = caml_callbackN_exn(..., ...);
if (Is_exception_result(x)) { exn = Extract_exception(r); } else { res = x };
exn and res are well-formed values and can be registered as roots, but x is not.
It could be argued that the caml_callback_exn API should be rewritten to avoid this problem, but I'm afraid we're stuck with it.
Original bug ID: 4343
Reporter: daweil
Status: closed (set by @xavierleroy on 2007-10-25T09:02:08Z)
Resolution: won't fix
Priority: normal
Severity: crash
Version: 3.10.0
Category: runtime system and C interface
Bug description
Why do this program crash ?
This small program call a CAML function which does nothing but do "raise Exit" from C.
Before the call to CAMLreturn, a call to another CAML function which compact the GC is triggered.
The program crash if the function caml_callback_exn is raised instead of caml_callback.
The correction I found was to write "caml_local_roots = caml_frame" before calling the second CAML function.
Is a bug in the CAML compiler or a bug in the documentation of the C/CAML writing rules ?
Daniel Weil
Additional information
To reproduce the bug, unzip the file src.zip
Type "make", the "make run".
The makefile is for Windows, but I suspect the bug to be reproductible on other OS also.
File attachments
The text was updated successfully, but these errors were encountered: