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-4622] App crashes when Swift optimization is selected. #47199

Closed
swift-ci opened this issue Apr 18, 2017 · 4 comments
Closed

[SR-4622] App crashes when Swift optimization is selected. #47199

swift-ci opened this issue Apr 18, 2017 · 4 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler itself crash Bug: A crash, i.e., an abnormal termination of software optimized only Flag: An issue whose reproduction requires optimized compilation run-time crash Bug → crash: Swift code crashed during execution

Comments

@swift-ci
Copy link
Contributor

Previous ID SR-4622
Radar None
Original Reporter babt (JIRA User)
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Environment

Xcode Version 8.3.1 (8E1000a) with Swift 3.1. macOS 10.12.4 (16E195) iOS 10.3.1 (14E304)

Additional Detail from JIRA
Votes 1
Component/s Compiler
Labels Bug, OptimizedOnly, RunTimeCrash
Assignee None
Priority Medium

md5: 35d418a7d55b30a2e90acddf9695618d

Issue Description:

The attached Xcode project provides a simple test case. If this app is built without optimization it runs as expected. However, when built using either single file optimization or whole module optimization, the app crashes attempting to convert a Swift.Error to an NSError using the swift_bridgeErrorToNSError() method.

Although this test case does not use any Obj-C code, some of the test classes being used to illustrate the problem were derived from a significantly larger app that does have some Obj-C in it and is running into the same problem.

Removal of the @objc decoration from the "RequestManager" class and it's delegate protocol "fixes" the problem. This is ok for this particular test case but in the larger app that this was derived from, that decoration is required as the real "RequestManager" and it's delegate are used by existing Objective-C code.

Steps to Reproduce:

  1. Install Xcode 8.3.1
  2. Unzip OptimizerTest.zip
  3. Open the OptimizerTest.xcodeproj
  4. Compile and run the app in either the simulator or on a device.

Expected Results:
"Invalid response" printed on the debug console via an NSLog statement.

Actual Results:
Application crashes with following trace:

@belkadan
Copy link
Contributor

Before we investigate further, can you try with Xcode 8.3.2? I know some NSError-related issues were fixed there.

@swift-ci
Copy link
Contributor Author

Comment by Bill Abt (JIRA)

We'll try it and see what happens. Will advise.

@swift-ci
Copy link
Contributor Author

Comment by Bill Abt (JIRA)

It appears to be fixed. I've been unable to reproduce the problem either in the test case or in our app.

@belkadan
Copy link
Contributor

Glad to hear it!

@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
This issue was closed.
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 itself crash Bug: A crash, i.e., an abnormal termination of software optimized only Flag: An issue whose reproduction requires optimized compilation run-time crash Bug → crash: Swift code crashed during execution
Projects
None yet
Development

No branches or pull requests

3 participants