Skip to content

Fix initialization of far float arrays - #2

Merged
khale merged 1 commit into
STRATA-5.5.0from
STRATA-5.5.0-fix-float-array-bug
Oct 20, 2026
Merged

khale merged 1 commit into
STRATA-5.5.0from
STRATA-5.5.0-fix-float-array-bug

Conversation

@plabondutta

Copy link
Copy Markdown
Collaborator

Root cause:

caml_array_make_far always built a generic array (tag 0) and copied init into every slot. For a float, init is the address of a boxed float, so Array.make ~far:true n 2.0 stored addresses that read back as ~4.7e-310, and Array.fill took the generic path for the same reason.

Fix:

When init is a boxed float (FLAT_FLOAT_ARRAY), use caml_array_create_float_far to get a proper Double_array_tag array and store Double_val(init) in each slot, matching the stock Array.make.

Test:

testsuite/tests/lib-array/far_float_array.ml

@Binkersss Binkersss left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me. Not sure how I made this oversight haha.

@khale

khale commented Oct 19, 2026

Copy link
Copy Markdown
Member

Looks like there are some checks failing?

@Binkersss

Binkersss commented Oct 19, 2026 via email

Copy link
Copy Markdown
Collaborator

@plabondutta

Copy link
Copy Markdown
Collaborator Author

I have created this PR to fix the CI issue. Once that one gets approved and merged, I will work on this one and update this PR.

@khale
khale merged commit e46980f into STRATA-5.5.0 Oct 20, 2026
11 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants