Skip to content

make ReinterpretArray more Offset-safe #58898

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

adienes
Copy link
Member

@adienes adienes commented Jul 4, 2025

fixes #44243 (and adds more tests besides)

@adienes adienes added arrays [a, r, r, a, y, s] bugfix This change fixes an existing bug labels Jul 4, 2025
@adienes adienes marked this pull request as draft July 4, 2025 03:56
@adienes adienes marked this pull request as ready for review July 4, 2025 17:01
@adienes
Copy link
Member Author

adienes commented Jul 7, 2025

I tried also adding a wrapper test for an offset array with non-zero offsets. I think the implementation is actually correct (besides what's fixed in this PR) and the tests would pass, but a lot of the tests check equality against a reference array which are no longer valid if the axes differ, so it requires a larger / more annoying refactoring to the test suite here.

@adienes
Copy link
Member Author

adienes commented Jul 20, 2025

one thing to note is that L91 actually makes the defensive first(axes(A, 2)) + ind.j - 1 here unnecessary and we could probably do a bare ind.j. but in the hypothetical case where in the future ReinterpretArray is made more offset-friendly, it would be easy to forget to update that.

another option would be to make the implementation ind.j for now but add a test to catch the hypothetical above

given that this expands the test coverage to two full new wrappers, only changes erroring paths into non-errors (and does not touch any non-erroring paths), and the implementation seems pretty uncontroversial to me, absent protest I'll merge this by the end of the week

@adienes adienes added the merge me PR is reviewed. Merge when all tests are passing label Jul 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
arrays [a, r, r, a, y, s] bugfix This change fixes an existing bug merge me PR is reviewed. Merge when all tests are passing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Vector indexing of wrappers of ReshapedReinterpretArray fails
1 participant