Skip to content

Commit

Permalink
Backport actual fix from the compiler.
Browse files Browse the repository at this point in the history
  • Loading branch information
toots committed Jan 23, 2024
1 parent c7505a9 commit b00087c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
0.8.5 (unreleased)
=====

- Fix note names (#18).
- Fix GC pace when allocating bigarrays with custom memory.

0.8.4 (2023-07-01)
=====
Expand Down
6 changes: 3 additions & 3 deletions src/image_data.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
CAMLexport value caml_mm_ba_alloc(int flags, int num_dims, void *data,
intnat *dim) {
uintnat num_elts, asize, size;
int i;
int i, is_managed;
value res;
struct caml_ba_array *b;
intnat dimcopy[CAML_BA_MAX_NUM_DIMS];
Expand All @@ -33,7 +33,6 @@ CAMLexport value caml_mm_ba_alloc(int flags, int num_dims, void *data,
CAMLassert((flags & CAML_BA_KIND_MASK) <= CAML_BA_CHAR);
for (i = 0; i < num_dims; i++)
dimcopy[i] = dim[i];
size = 0;
num_elts = 1;
for (i = 0; i < num_dims; i++) {
if (caml_umul_overflow(num_elts, dimcopy[i], &num_elts))
Expand All @@ -49,7 +48,8 @@ CAMLexport value caml_mm_ba_alloc(int flags, int num_dims, void *data,
flags |= CAML_BA_MANAGED;
}
asize = SIZEOF_BA_ARRAY + num_dims * sizeof(intnat);
res = caml_alloc_custom_mem(&caml_ba_ops, asize, size);
is_managed = ((flags & CAML_BA_MANAGED_MASK) == CAML_BA_MANAGED);
res = caml_alloc_custom_mem(&caml_ba_ops, asize, is_managed ? size : 0);
b = Caml_ba_array_val(res);
b->data = data;
b->num_dims = num_dims;
Expand Down

0 comments on commit b00087c

Please sign in to comment.