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

[SR-14264] Swift compiler fails with a segmentation fault #56624

Open
brennanMKE mannequin opened this issue Feb 22, 2021 · 6 comments
Open

[SR-14264] Swift compiler fails with a segmentation fault #56624

brennanMKE mannequin opened this issue Feb 22, 2021 · 6 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software

Comments

@brennanMKE
Copy link
Mannequin

brennanMKE mannequin commented Feb 22, 2021

Previous ID SR-14264
Radar rdar://problem/74652013
Original Reporter @brennanMKE
Type Bug

Attachment: Download

Environment

Xcode Version 12.5 beta 2 (12E5234g)

Additional Detail from JIRA
Votes 2
Component/s Compiler
Labels Bug, CompilerCrash
Assignee None
Priority Medium

md5: 1048836b7df86d112140a87f343fd6e7

Issue Description:

Some Swift code is not able to build with the Xcode beta with code which calls Objective-C code with multiple closures. Log attached.

Xcode Version 12.5 beta 2 (12E5234g)

The Objective-C function definition is below.

- (void)enumerateToAssignBlocksForUploadTask:(nullable void (^)(AWSS3TransferUtilityUploadTask *uploadTask,
                                                                _Nullable AWSS3TransferUtilityProgressBlock * _Nullable uploadProgressBlockReference,
                                                                _Nullable AWSS3TransferUtilityUploadCompletionHandlerBlock * _Nullable completionHandlerReference))uploadBlocksAssigner
                                downloadTask:(nullable void (^)(AWSS3TransferUtilityDownloadTask *downloadTask,
                                                                _Nullable AWSS3TransferUtilityProgressBlock * _Nullable downloadProgressBlockReference,
                                                                _Nullable AWSS3TransferUtilityDownloadCompletionHandlerBlock * _Nullable completionHandlerReference))downloadBlocksAssigner;

To get around this error I created an Objective-C Category which is defined in MyApp.zip which exposes a simpler function to Swift which is used instead.

@brennanMKE
Copy link
Mannequin Author

brennanMKE mannequin commented Feb 23, 2021

I've narrowed down the failure further. See MyFramework.zip. It includes a git history of the changes. It appears adding NSError to the list of parameters is what causes the segmentation fault. It does not fail in previous release versions of Xcode.

@typesanitizer
Copy link

@swift-ci create

@brennanMKE
Copy link
Mannequin Author

brennanMKE mannequin commented Apr 23, 2021

Xcode 12.5 RC is out now. Was this issue handled with this update?

@brennanMKE
Copy link
Mannequin Author

brennanMKE mannequin commented Apr 23, 2021

I just tried building the included MyApp sample project. It still gets the segfault when the flag for

USE_OBJC_CATEGORY is excluded.

@swift-ci
Copy link
Collaborator

Comment by Grant Furick (JIRA)

This is blocking for our app that utilizes the aws sdk. Thanks for logging this issue as we have reproduced. I'm holding back build server update and haven't had to do that in a while.

@brennanMKE
Copy link
Mannequin Author

brennanMKE mannequin commented Sep 21, 2021

I've created an alternate API to get around this issue. See the comment at the bottom of the issue below to see sample code.

aws-amplify/aws-sdk-ios#3725

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added the crash Bug: A crash, i.e., an abnormal termination of software label Dec 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software
Projects
None yet
Development

No branches or pull requests

3 participants