Skip to content

[BoundsSafety] Don't bind lvalues with temporary locations #10989

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 4 commits into
base: swift/release/6.2
Choose a base branch
from

Conversation

rapidsna
Copy link

This should fix a miscompilation bug found during adoption.
When a base is lvalue and is wrapped in OVE, the compiler
incorrectly creates a temporary and maps its address to the lvalue
instead of the actual address of the lvalue.

The solution is to emit lvalue directly instead of creating
extra temporary.

rdar://146329029

rapidsna added 4 commits July 11, 2025 10:51
This should fix a miscompilation bug found during adoption.
When a base is lvalue and is wrapped in OVE, the compiler
incorrectly creates a temporary and maps its address to the lvalue
instead of the actual address of the lvalue.

The solution is to emit lvalue directly instead of creating
extra temporary.

rdar://146329029
(cherry picked from commit 8dd1309)
…ing in order to avoid non-determinism

The execution order of arguments is unspecified in C++. Directly
passing calls that emit code as arguments caused non-deterministic
order in the generated instructions and test failures in different
platforms.

(cherry picked from commit 0a18d9a)
@rapidsna rapidsna requested a review from a team as a code owner July 11, 2025 21:58
@rapidsna rapidsna added the clang:bounds-safety Issue relating to the experimental -fbounds-safety feature in Clang label Jul 11, 2025
@rapidsna
Copy link
Author

@swift-ci test llvm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
clang:bounds-safety Issue relating to the experimental -fbounds-safety feature in Clang
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant