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-7314] Xcode 9.3 compiler crash #49862

Closed
bealex opened this issue Mar 30, 2018 · 8 comments
Closed

[SR-7314] Xcode 9.3 compiler crash #49862

bealex opened this issue Mar 30, 2018 · 8 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

@bealex
Copy link

bealex commented Mar 30, 2018

Previous ID SR-7314
Radar rdar://problem/39050300
Original Reporter @bealex
Type Bug
Status Resolved
Resolution Done
Environment

Xcode Version 9.3 (9E145)

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, CompilerCrash
Assignee shajrawi (JIRA)
Priority Medium

md5: 1b3b256571e57aa52a358a0373b44a2d

Issue Description:

Here is the code that crashes the compiler:

struct Object {
    var id: String
    var string: String
}

struct Data {
    var string: String
    var tap: ((Object) -> Void)?
}

class TestClass {
    var data: Data?

    func crash() {
        guard let data = data else { return }
        foo(a: "", tap: data.tap)
    }

    @discardableResult
    private func foo(a: String, tap: ((Object) -> Void)?) -> [String] {
        return []
    }
}

Stacktrace:

0  swift                    0x000000010a10fffa PrintStackTraceSignalHandler(void*) + 42
1  swift                    0x000000010a10f3b6 SignalHandler(int) + 966
2  libsystem_platform.dylib 0x00007fff6675df5a _sigtramp + 26
3  libsystem_platform.dylib 0x00007f0100000008 _sigtramp + 2575966408
4  swift                    0x00000001067bc24d llvm::IRBuilder<llvm::ConstantFolder, llvm::IRBuilderDefaultInserter>::CreateCast(llvm::Instruction::CastOps, llvm::Value*, llvm::Type*, llvm::Twine const&) + 77
5  swift                    0x00000001068cdcca swift::irgen::reemitAsUnsubstituted(swift::irgen::IRGenFunction&, swift::SILType, swift::SILType, swift::irgen::Explosion&, swift::irgen::Explosion&) + 522
6  swift                    0x0000000106955da9 emitApplyArgument((anonymous namespace)::IRGenSILFunction&, swift::SILValue, swift::SILType, swift::irgen::Explosion&) + 393
7  swift                    0x0000000106955119 (anonymous namespace)::IRGenSILFunction::visitFullApplySite(swift::FullApplySite) + 2569
8  swift                    0x0000000106932ff1 swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 9073
9  swift                    0x0000000106828070 swift::irgen::IRGenerator::emitGlobalTopLevel() + 1024
10 swift                    0x0000000106914527 performIRGeneration(swift::IRGenOptions&, swift::ModuleDecl*, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, llvm::StringRef, llvm::LLVMContext&, swift::SourceFile*, llvm::GlobalVariable**, unsigned int) + 1399
11 swift                    0x000000010676fdce performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 38110
12 swift                    0x0000000106764e64 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 7908
13 swift                    0x00000001067198b5 main + 18917
14 libdyld.dylib            0x00007fff6644f015 start + 1
@hamishknight
Copy link
Collaborator

Looks like this is fixed on master.

@belkadan
Copy link
Contributor

belkadan commented Apr 3, 2018

It works for me on the command line with 9.3. Can you give us some more reproduction instructions?

@belkadan
Copy link
Contributor

belkadan commented Apr 3, 2018

(or attach a project where it's failing)

@belkadan
Copy link
Contributor

belkadan commented Apr 3, 2018

Ah, never mind, it only failed unoptimized. And does indeed seem to be fixed on master.

@slavapestov, ring any bells?

@belkadan
Copy link
Contributor

belkadan commented Apr 3, 2018

aschwaighofer@apple.com (JIRA User)?

@aschwaighofer
Copy link
Member

CC shajrawi (JIRA User) probably a dupe of the two issues that you are looking

@aschwaighofer
Copy link
Member

... looking at

@swift-ci
Copy link
Collaborator

swift-ci commented Apr 4, 2018

Comment by Joe Shajrawi (JIRA)

Fixed on master: #15721

@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 in itself crash Bug: A crash, i.e., an abnormal termination of software
Projects
None yet
Development

No branches or pull requests

6 participants