Skip to content

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 created a temporary and incorrectly mapped the temporary's address as the lvalue instead of the actual address of the lvalue.

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

  • Issue with the solution:

The issue #10969 got originally reverted due "error: cannot compile this l-value expression yet" occurred when __terminated_by_to_indexable is wrapped in an OVE.

  • Fix for the new issue with __terminated_by_to_indexable:

The fix is to implement "TerminatedByToIndexableExprLValue" so the codegen can also emit as if it's an lvalue.

rdar://146329029
(cherry picked from commit 04da1af)

… temporary locations (#11469)

- Solution from #10969:

This should fix a miscompilation bug found during adoption. When a base is lvalue and is wrapped in OVE, the compiler created a temporary and incorrectly mapped the temporary's address as the lvalue instead of the actual address of the lvalue.

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

- Issue with the solution:

The issue #10969 got originally reverted due "error: cannot compile this l-value expression yet" occurred when __terminated_by_to_indexable is wrapped in an OVE.

- Fix for the new issue with __terminated_by_to_indexable:

The fix is to implement "TerminatedByToIndexableExprLValue" so the codegen can also emit as if it's an lvalue.

rdar://146329029
(cherry picked from commit 04da1af)
@rapidsna rapidsna added the clang:bounds-safety Issue relating to the experimental -fbounds-safety feature in Clang label Sep 26, 2025
@rapidsna
Copy link
Author

@swift-ci test llvm

@rapidsna rapidsna merged commit 34bdb2f into stable/21.x Sep 27, 2025
2 checks passed
@rapidsna rapidsna deleted the eng/PR-146329029_stable/21.x branch September 27, 2025 23:50
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