Skip to content
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

Fix array to ptr decay assignments #515

Merged
merged 1 commit into from
Apr 7, 2024

Conversation

marcauberer
Copy link
Member

This fixes miscompilations when assigning arrays with known size to pointers by value. This corresponds to an array to pointer decay and can be performed with an inbounds GEP and behaves essentially the same as when assigning the address of the 0th array element to the pointer e.g. int* intPtr = intArray is equivalent to int* intPtr = &intArray[0], but only the former was working. Now do both.

@marcauberer marcauberer added the bug Something isn't working label Apr 7, 2024
@marcauberer marcauberer added this to the 0.20.0 milestone Apr 7, 2024
@marcauberer marcauberer self-assigned this Apr 7, 2024
@marcauberer marcauberer requested a review from a team as a code owner April 7, 2024 21:19
@marcauberer marcauberer merged commit 77f9747 into main Apr 7, 2024
4 checks passed
@marcauberer marcauberer deleted the fix/array-to-ptr-decay-assign branch April 7, 2024 21:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compiler size/S
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant