Skip to content

Commit 96b9e1b

Browse files
authored
flambda-backend: Print diagnostics at runtime for Invalid (ocaml-flambda#530)
1 parent 42ab88e commit 96b9e1b

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

runtime/misc.c

+16
Original file line numberDiff line numberDiff line change
@@ -202,3 +202,19 @@ int caml_runtime_warnings_active(void)
202202
}
203203
return 1;
204204
}
205+
206+
/* Flambda 2 invalid term markers */
207+
208+
CAMLnoreturn_start
209+
void caml_flambda2_invalid (value message)
210+
CAMLnoreturn_end;
211+
212+
void caml_flambda2_invalid (value message)
213+
{
214+
fprintf (stderr, "[ocaml] [flambda2] Invalid code:\n%s\n\n",
215+
String_val(message));
216+
fprintf (stderr, "This might have arisen from a wrong use of [Obj.magic].\n");
217+
fprintf (stderr, "Consider using [Sys.opaque_identity].\n");
218+
abort ();
219+
}
220+

0 commit comments

Comments
 (0)