Skip to content

[SR-1806] Swift 3 Preview 1 Segmentation Fault in getSILFunctionType() #44415

Closed
@swift-ci

Description

@swift-ci
Previous ID SR-1806
Radar None
Original Reporter pwestrich (JIRA User)
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Environment

macOS Sierra DeveloperPreview 1 (16A201w)
Xcode 8 beta (8S128d)
Apple Swift version 3.0 (swiftlang-800.0.30 clang-800.0.24) Target: x86_64-apple-macosx10.9

Additional Detail from JIRA
Votes 1
Component/s Compiler
Labels Bug, CompilerCrash, SILGen
Assignee @slavapestov
Priority Medium

md5: 5e07c41e934d87ff1a99e3ef23fbd32a

Issue Description:

I was attempting to update one of my projects to work with Swift 3, and I've encountered a segmentation fault in the compiler when trying to build one of the libraries I'm updating. I've attached the specific file that's causing it, and the stack trace is below. This file builds perfectly fine when using Xcode 7.3.1 (7D1014) before the syntax update.

$swift ChartDataEntry.swift 
0  swift                    0x000000010342e34b llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 43
1  swift                    0x000000010342d636 llvm::sys::RunSignalHandlers() + 70
2  swift                    0x000000010342e99f SignalHandler(int) + 287
3  libsystem_platform.dylib 0x00007fffb494a01a _sigtramp + 26
4  libsystem_platform.dylib 000000000000000000 _sigtramp + 1265328128
5  swift                    0x00000001013230d9 getSILFunctionType(swift::SILModule&, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::AnyFunctionType>, swift::AnyFunctionType::ExtInfo, (anonymous namespace)::Conventions const&, llvm::Optional<swift::ForeignErrorConvention> const&, llvm::Optional<swift::SILDeclRef>) + 1081
6  swift                    0x00000001013208b6 getUncachedSILFunctionTypeForConstant(swift::SILModule&, swift::SILDeclRef, swift::CanTypeWrapper<swift::AnyFunctionType>) + 1254
7  swift                    0x000000010102a1bc getDynamicMethodLoweredType(swift::Lowering::SILGenFunction&, swift::SILValue, swift::SILDeclRef, swift::CanTypeWrapper<swift::AnyFunctionType>) + 220
8  swift                    0x00000001010299bc swift::Lowering::SILGenFunction::emitDynamicMemberRefExpr(swift::DynamicMemberRefExpr*, swift::Lowering::SGFContext) + 1196
9  swift                    0x0000000101058180 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 1920
10 swift                    0x0000000101061b89 void llvm::function_ref<void (swift::Expr*)>::callback_fn<swift::Lowering::RValue swift::Lowering::SILGenFunction::emitOpenExistentialExpr<swift::Lowering::RValue, (anonymous namespace)::RValueEmitter::visitOpenExistentialExpr(swift::OpenExistentialExpr*, swift::Lowering::SGFContext)::$_4>(swift::OpenExistentialExpr*, (anonymous namespace)::RValueEmitter::visitOpenExistentialExpr(swift::OpenExistentialExpr*, swift::Lowering::SGFContext)::$_4)::'lambda'(swift::Expr*)>(long, swift::Expr*) + 41
11 swift                    0x00000001010571da swift::Lowering::SILGenFunction::emitOpenExistentialExprImpl(swift::OpenExistentialExpr*, llvm::function_ref<void (swift::Expr*)>) + 954
12 swift                    0x0000000101061b01 swift::Lowering::RValue swift::Lowering::SILGenFunction::emitOpenExistentialExpr<swift::Lowering::RValue, (anonymous namespace)::RValueEmitter::visitOpenExistentialExpr(swift::OpenExistentialExpr*, swift::Lowering::SGFContext)::$_4>(swift::OpenExistentialExpr*, (anonymous namespace)::RValueEmitter::visitOpenExistentialExpr(swift::OpenExistentialExpr*, swift::Lowering::SGFContext)::$_4) + 65
13 swift                    0x0000000101059070 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 5744
14 swift                    0x00000001010535a8 swift::Lowering::SILGenFunction::emitExprInto(swift::Expr*, swift::Lowering::Initialization*) + 280
15 swift                    0x0000000101061664 (anonymous namespace)::RValueEmitter::emitForceValue(swift::SILLocation, swift::Expr*, unsigned int, swift::Lowering::SGFContext) + 756
16 swift                    0x000000010105904b swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 5707
17 swift                    0x00000001010567bf swift::Lowering::SILGenFunction::emitRValueAsSingleValue(swift::Expr*, swift::Lowering::SGFContext) + 47
18 swift                    0x0000000101058ee4 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 5348
19 swift                    0x00000001010567bf swift::Lowering::SILGenFunction::emitRValueAsSingleValue(swift::Expr*, swift::Lowering::SGFContext) + 47
20 swift                    0x000000010108a49a swift::Lowering::SILGenFunction::emitRValueAsOrig(swift::Expr*, swift::Lowering::AbstractionPattern, swift::Lowering::TypeLowering const&, swift::Lowering::SGFContext) + 346
21 swift                    0x0000000101062a61 swift::Lowering::ManagedValue llvm::function_ref<swift::Lowering::ManagedValue (swift::Lowering::SGFContext)>::callback_fn<(anonymous namespace)::RValueEmitter::visitErasureExpr(swift::ErasureExpr*, swift::Lowering::SGFContext)::$_3>(long, swift::Lowering::SGFContext) + 113
22 swift                    0x0000000101044eb0 swift::Lowering::SILGenFunction::emitExistentialErasure(swift::SILLocation, swift::CanType, swift::Lowering::TypeLowering const&, swift::Lowering::TypeLowering const&, llvm::ArrayRef<swift::ProtocolConformanceRef>, swift::Lowering::SGFContext, llvm::function_ref<swift::Lowering::ManagedValue (swift::Lowering::SGFContext)>) + 1120
23 swift                    0x00000001010598c1 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 7873
24 swift                    0x00000001010567bf swift::Lowering::SILGenFunction::emitRValueAsSingleValue(swift::Expr*, swift::Lowering::SGFContext) + 47
25 swift                    0x000000010100f704 swift::Lowering::ArgumentSource::getAsSingleValue(swift::Lowering::SILGenFunction&, swift::Lowering::SGFContext) && + 340
26 swift                    0x000000010100f7bd swift::Lowering::ArgumentSource::getAsSingleValue(swift::Lowering::SILGenFunction&, swift::Lowering::AbstractionPattern, swift::Lowering::SGFContext) && + 157
27 swift                    0x000000010102295e swift::Lowering::SILGenFunction::emitInjectEnum(swift::SILLocation, swift::Lowering::ArgumentSource, swift::SILType, swift::EnumElementDecl*, swift::Lowering::SGFContext) + 1726
28 swift                    0x000000010105f988 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 32648
29 swift                    0x00000001010567bf swift::Lowering::SILGenFunction::emitRValueAsSingleValue(swift::Expr*, swift::Lowering::SGFContext) + 47
30 swift                    0x000000010105ccfc swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 21244
31 swift                    0x0000000101053656 swift::Lowering::SILGenFunction::emitRValue(swift::Expr*, swift::Lowering::SGFContext) + 22
32 swift                    0x000000010103287d (anonymous namespace)::ArgEmitter::emit(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 1069
33 swift                    0x00000001010332d5 (anonymous namespace)::ArgEmitter::emitExpanded(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 261
34 swift                    0x0000000101032520 (anonymous namespace)::ArgEmitter::emit(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 208
35 swift                    0x0000000101031c87 (anonymous namespace)::CallSite::emit(swift::Lowering::SILGenFunction&, swift::Lowering::AbstractionPattern, (anonymous namespace)::ParamLowering&, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, llvm::SmallVectorImpl<std::__1::pair<swift::Lowering::LValue, swift::SILLocation> >&, llvm::Optional<swift::ForeignErrorConvention> const&, swift::ImportAsMemberStatus const&) && + 455
36 swift                    0x00000001010241ee (anonymous namespace)::CallEmission::apply(swift::Lowering::SGFContext) + 3886
37 swift                    0x0000000101022c33 swift::Lowering::SILGenFunction::emitApplyExpr(swift::Expr*, swift::Lowering::SGFContext) + 51
38 swift                    0x0000000101057a53 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 83
39 swift                    0x00000001010567bf swift::Lowering::SILGenFunction::emitRValueAsSingleValue(swift::Expr*, swift::Lowering::SGFContext) + 47
40 swift                    0x000000010100f704 swift::Lowering::ArgumentSource::getAsSingleValue(swift::Lowering::SILGenFunction&, swift::Lowering::SGFContext) && + 340
41 swift                    0x0000000101032fad (anonymous namespace)::ArgEmitter::emit(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 2909
42 swift                    0x00000001010332d5 (anonymous namespace)::ArgEmitter::emitExpanded(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 261
43 swift                    0x0000000101032520 (anonymous namespace)::ArgEmitter::emit(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 208
44 swift                    0x0000000101031c87 (anonymous namespace)::CallSite::emit(swift::Lowering::SILGenFunction&, swift::Lowering::AbstractionPattern, (anonymous namespace)::ParamLowering&, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, llvm::SmallVectorImpl<std::__1::pair<swift::Lowering::LValue, swift::SILLocation> >&, llvm::Optional<swift::ForeignErrorConvention> const&, swift::ImportAsMemberStatus const&) && + 455
45 swift                    0x00000001010241ee (anonymous namespace)::CallEmission::apply(swift::Lowering::SGFContext) + 3886
46 swift                    0x0000000101022c33 swift::Lowering::SILGenFunction::emitApplyExpr(swift::Expr*, swift::Lowering::SGFContext) + 51
47 swift                    0x0000000101057a53 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 83
48 swift                    0x000000010105ae6c swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 13420
49 swift                    0x0000000101053656 swift::Lowering::SILGenFunction::emitRValue(swift::Expr*, swift::Lowering::SGFContext) + 22
50 swift                    0x000000010103287d (anonymous namespace)::ArgEmitter::emit(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 1069
51 swift                    0x0000000101031c87 (anonymous namespace)::CallSite::emit(swift::Lowering::SILGenFunction&, swift::Lowering::AbstractionPattern, (anonymous namespace)::ParamLowering&, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, llvm::SmallVectorImpl<std::__1::pair<swift::Lowering::LValue, swift::SILLocation> >&, llvm::Optional<swift::ForeignErrorConvention> const&, swift::ImportAsMemberStatus const&) && + 455
52 swift                    0x00000001010241ee (anonymous namespace)::CallEmission::apply(swift::Lowering::SGFContext) + 3886
53 swift                    0x0000000101022c33 swift::Lowering::SILGenFunction::emitApplyExpr(swift::Expr*, swift::Lowering::SGFContext) + 51
54 swift                    0x0000000101057a53 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 83
55 swift                    0x0000000101053656 swift::Lowering::SILGenFunction::emitRValue(swift::Expr*, swift::Lowering::SGFContext) + 22
56 swift                    0x00000001010474cc swift::Lowering::SILGenFunction::emitStmtCondition(llvm::MutableArrayRef<swift::StmtConditionElement>, swift::Lowering::JumpDest, swift::SILLocation) + 732
57 swift                    0x000000010109ceba swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 6266
58 swift                    0x000000010109c281 swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 3137
59 swift                    0x000000010109b635 swift::Lowering::SILGenFunction::emitStmt(swift::Stmt*) + 21
60 swift                    0x0000000101067695 swift::Lowering::SILGenFunction::emitFunction(swift::FuncDecl*) + 309
61 swift                    0x000000010101ed16 swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*)::$_1::operator()(swift::SILFunction*) const + 198
62 swift                    0x00000001010176e2 swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*) + 610
63 swift                    0x00000001010a0595 (anonymous namespace)::SILGenType::emitType() + 1013
64 swift                    0x00000001010a012e swift::Lowering::SILGenModule::visitNominalTypeDecl(swift::NominalTypeDecl*) + 30
65 swift                    0x000000010101c1db swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*, unsigned int) + 747
66 swift                    0x000000010101ce72 swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*, llvm::Optional<unsigned int>, bool, bool) + 898
67 swift                    0x000000010101d216 swift::performSILGeneration(swift::ModuleDecl*, swift::SILOptions&, bool, bool) + 38
68 swift                    0x0000000100eee850 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*) + 13024
69 swift                    0x0000000100eea619 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2873
70 swift                    0x0000000100eb86c4 main + 2852
71 libdyld.dylib            0x00007fffb473f285 start + 1
Stack dump:
0.  Program arguments: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -interpret ChartDataEntry.swift -target x86_64-apple-macosx10.9 -enable-objc-interop -sdk /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -color-diagnostics -module-name ChartDataEntry 
1.  While emitting SIL for 'isEqual' at ChartDataEntry.swift:52:21
Segmentation fault: 11

Metadata

Metadata

Assignees

Labels

SILGenArea → compiler: The SIL generation stagebugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfcrashBug: A crash, i.e., an abnormal termination of software

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions