Skip to content

Commit d721134

Browse files
authored
Refine assertion in caml_modify_local (#2244)
1 parent bb56f26 commit d721134

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

ocaml/runtime/memory.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,8 +358,11 @@ CAMLexport int caml_is_stack (value v)
358358
CAMLexport void caml_modify_local (value obj, intnat i, value val)
359359
{
360360
if (Color_hd(Hd_val(obj)) == NOT_MARKABLE) {
361-
/* This function should not be used on external values */
362-
CAMLassert(caml_is_stack(obj));
361+
/* This function should not be used on external values, but we have seen
362+
some cases where it has been, in safe contexts where only immediate
363+
values are involved. */
364+
CAMLassert(caml_is_stack(obj)
365+
|| (!Is_block(val) && !Is_block(Field(obj, i))));
363366
Field(obj, i) = val;
364367
} else {
365368
caml_modify(&Field(obj, i), val);

0 commit comments

Comments
 (0)