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-3666] Swift 3 compiler with optimization crashes or produces crashing binary. #46251

swift-ci opened this issue Jan 18, 2017 · 2 comments


Copy link

@swift-ci swift-ci commented Jan 18, 2017

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

Attachment: Download


Apple Swift version 3.0.2 (swiftlang-800.0.63 clang-800.0.42.1)
Target: x86_64-apple-macosx10.9

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

md5: 6da5c3680c3f1a23f623e8712ce8d495

Issue Description:

protocol ExampleProtocol
    func execute()

class Example: ExampleProtocol
    init() throws {

    func execute() {

let instance: ExampleProtocol

do {
    instance = try Example()
} catch (_) {}

In debug this code compiles and runs fine. However, with Swift Compiler Optimization turned on (`-O` with or without whole module optimization), a crashing binary is produced. The binary only outputs "one" and then crashes with a bad access exception.

Additionally, if you leave an empty body for the `init()` method, the compiler crashes.

Attached you'll find an example project to reproduce the issue and the crash log from the compiler.

This bug was found upon compiling a Release version of an App of ours after migrating to Swift 3. This bug was not present in the Swift 2 compiled version.

Copy link

@belkadan belkadan commented Jan 19, 2017

Seems to be fixed in master. If you want to test this sooner rather than later, you can download a development snapshot from

Copy link
Collaborator Author

@swift-ci swift-ci commented Jan 19, 2017

Comment by Daniel Sandoval (JIRA)

@belkadan Hi, thanks for taking a look. I've downloaded the toolchain using the link you provided but the problem doesn't seem to be fixed. I've tried to compile the example project attached to the issue but got an "Abort trap: 6." I've attached the compile log below.

Build target swift-indirection_2017-01-19T16-34-47.rtf

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

2 participants