Skip to content

Swift SIL: Fix argument conventions for functions which have both, a direct and indirect result#81806

Merged
eeckstein merged 1 commit intoswiftlang:mainfrom
eeckstein:fix-argument-convention
May 30, 2025
Merged

Swift SIL: Fix argument conventions for functions which have both, a direct and indirect result#81806
eeckstein merged 1 commit intoswiftlang:mainfrom
eeckstein:fix-argument-convention

Conversation

@eeckstein
Copy link
Copy Markdown
Contributor

The function convention for the first argument is not identified as indirect-out. This lets alias analysis assume that the memory pointed to by argument 0 cannot be written by the called function.

The problem is that subscripting a LazyFilterCollection (with the base index, e.g. Int) does not work as expected, because it returns the nth element of the base collection! The fix is to implement the subscript "manually".

Fixes a mis-compile.
rdar://152160748

…direct and indirect result.

The function convention for the first argument is not identified as indirect-out.
This lets alias analysis assume that the memory pointed to by argument 0 cannot be written by the called function.

The problem is that subscripting a LazyFilterCollection (with the base index, e.g. `Int`) does not work as expected, because it returns the nth element of the base collection!
The fix is to implement the subscript "manually".

Fixes a mis-compile.
rdar://152160748
@eeckstein
Copy link
Copy Markdown
Contributor Author

@swift-ci test

@eeckstein eeckstein requested a review from atrick May 28, 2025 16:08
Copy link
Copy Markdown
Contributor

@atrick atrick left a comment

Choose a reason for hiding this comment

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

Thanks for tracking this down.

@eeckstein
Copy link
Copy Markdown
Contributor Author

@swift-ci smoke test macos

@eeckstein eeckstein merged commit 0654dc7 into swiftlang:main May 30, 2025
4 of 5 checks passed
@eeckstein eeckstein deleted the fix-argument-convention branch May 30, 2025 10:30
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