Skip to content

[SR-6041] Compiler crash in constructSIL instead of error when explicitly specifying an incorrect generic type parameter #48598

@bobergj

Description

@bobergj
Previous ID SR-6041
Radar None
Original Reporter @bobergj
Type Bug
Status Closed
Resolution Done

Attachment: Download

Environment

Xcode Version 9.0 (9A235), Swift 4

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

md5: 317bdd1ca1d9215d7e1b36833d9a47d4

Issue Description:

How to reproduce:

Compile the attached file.

$ swift Test.swift

0  swift                    0x0000000111796dba PrintStackTraceSignalHandler(void*) + 42
1  swift                    0x00000001117961f6 SignalHandler(int) + 662
2  libsystem_platform.dylib 0x00007fffbb469b3a _sigtramp + 26
3  swift                    0x000000010e955100 swift::Lowering::CleanupManager::endScope(swift::DiverseStackBase::stable_iterator, swift::CleanupLocation) + 96
4  swift                    0x000000010f2f4c15 swift::NominalTypeDecl::hasFixedLayout() const + 21
5  swift                    0x000000010ee88931 (anonymous namespace)::LowerType::visitAnyStructType(swift::CanType, swift::StructDecl*) + 49
6  swift                    0x000000010ee876c7 swift::Lowering::TypeConverter::getTypeLowering(swift::Lowering::AbstractionPattern, swift::Type) + 2791
7  swift                    0x000000010e9bc36f swift::Lowering::SILGenFunction::emitInitializationForVarDecl(swift::VarDecl*) + 1775
8  swift                    0x000000010e9be643 swift::Lowering::SILGenFunction::emitPatternBinding(swift::PatternBindingDecl*, unsigned int) + 83
9  swift                    0x000000010ea3c10d swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 1885
10 swift                    0x000000010e9f3389 swift::Lowering::SILGenFunction::emitFunction(swift::FuncDecl*) + 393
11 swift                    0x000000010e9693a1 swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*)::$_1::operator()(swift::SILFunction*) const + 273
12 swift                    0x000000010e968919 swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*) + 761
13 swift                    0x000000010e96fee1 swift::ASTVisitor<swift::Lowering::SILGenModule, void, void, void, void, void, void>::visit(swift::Decl*) + 641
14 swift                    0x000000010e96ef6b swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*, unsigned int) + 1115
15 swift                    0x000000010e970942 swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*, llvm::Optional<unsigned int>, bool) + 914
16 swift                    0x000000010e10931b performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 13099
17 swift                    0x000000010e104784 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 7716
18 swift                    0x000000010e0b96a8 main + 12248
19 libdyld.dylib            0x00007fffbb25a235 start + 1
20 libdyld.dylib            0x000000000000000a start + 1155161558
Stack dump:
0.  Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -interpret Test.swift -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -color-diagnostics -module-name Test 
1.  While emitting SIL for 'test()' at Test.swift:93:1

$ swift --version

Apple Swift version 4.0 (swiftlang-900.0.65 clang-900.0.37)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA 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