Skip to content

Hotfix resolve index projection for references/pointers #637

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

Merged
merged 3 commits into from
Aug 5, 2025

Conversation

jberthold
Copy link
Member

The projections stored within a reference or pointer may include Index(L:Local) , indexing with an index read from a local.
When creating a reference or pointer, the context is lost, so the actual index must be read from the local and stored as a ConstantIndex projection.

Also adding a test for a previous change (offset correction when passing structs holding references across stack frame boundaries)

}

fn g(x: *const u32) {
// assert!(unsafe{*x} == 0); // deref alignment check currently failing
Copy link
Member Author

Choose a reason for hiding this comment

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

This line creates code for the pointer alignment check which currently creates thunks and gets stuck.
The alignment check (as well as the unOpOffset) require simulating an address according to the referenced type, its (original) size and alignment must be respected on offsets and when transmuteing pointers to numbers.

image

@jberthold jberthold marked this pull request as ready for review August 1, 2025 06:58
@jberthold jberthold requested a review from dkcumming August 1, 2025 06:58
Copy link
Collaborator

@dkcumming dkcumming left a comment

Choose a reason for hiding this comment

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

Looks good

@jberthold jberthold merged commit b65361b into master Aug 5, 2025
5 checks passed
@jberthold jberthold deleted the HOTFIX-resolve-index-projection-for-references branch August 5, 2025 03:55
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.

2 participants