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-7005] crash in swift::Lowering::SILGenModule::getWitnessTable #49553

Closed
tali opened this issue Feb 15, 2018 · 4 comments
Closed

[SR-7005] crash in swift::Lowering::SILGenModule::getWitnessTable #49553

tali opened this issue Feb 15, 2018 · 4 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 regression swift 4.1

Comments

@tali
Copy link

tali commented Feb 15, 2018

Previous ID SR-7005
Radar rdar://problem/37572940
Original Reporter @tali
Type Bug
Status Resolved
Resolution Cannot Reproduce

Attachment: Download

Environment
swift -version
Apple Swift version 4.1 (swiftlang-902.0.38 clang-902.0.30)
Target: x86_64-apple-darwin17.4.0
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, 4.1Regression, CompilerCrash
Assignee None
Priority Medium

md5: e1f32d6736cfa579538914670595c737

Issue Description:

In Swift 4.1, one of my projects triggered a compiler crash:

swift -version
Apple Swift version 4.1 (swiftlang-902.0.38 clang-902.0.30)
Target: x86_64-apple-darwin17.4.0
swift -frontend -c -primary-file bug.swift -parse-as-library
0  swift                    0x000000010b5496ba PrintStackTraceSignalHandler(void*) + 42
1  swift                    0x000000010b548a76 SignalHandler(int) + 966
2  libsystem_platform.dylib 0x00007fff77291f5a _sigtramp + 26
3  libsystem_platform.dylib 0x00007fca0000000e _sigtramp + 2295783630
4  swift                    0x000000010854292d swift::Lowering::SILGenModule::getWitnessTable(swift::ProtocolConformance*) + 429
5  swift                    0x000000010846735b swift::ASTVisitor<swift::Lowering::SILGenModule, void, void, void, void, void, void>::visit(swift::Decl*) + 843
6  swift                    0x000000010846618b swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*, unsigned int) + 1371
7  swift                    0x0000000108467d71 swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*, llvm::Optional<unsigned int>, bool) + 865
8  swift                    0x0000000107bac45c performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 27340
9  swift                    0x0000000107ba3f14 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 7908
10 swift                    0x0000000107b58955 main + 18917
11 libdyld.dylib            0x00007fff77010115 start + 1
12 libdyld.dylib            0x0000000000000006 start + 2298412786
Stack dump:
0.      Program arguments: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file bug.swift -parse-as-library

I could reduce the problem to the following program:

struct Thing<Result> {}

extension Thing: ExpressibleByUnicodeScalarLiteral where Result == String {} 

let x = Thing<String>()

using the following invocation:

swift -frontend -c -primary-file bug.swift -parse-as-library

Without the -parse-as-library, swift correctly complains that 'Thing<Result>' does not conform to protocol 'ExpressibleByUnicodeScalarLiteral', with that option it just seg-faults.

@belkadan
Copy link
Contributor

Very weird! Thanks, Martin.

@swift-ci create

@belkadan
Copy link
Contributor

With asserts:

extension of Thing<String> is missing witness for ExpressibleByUnicodeScalarLiteral.init

6  swift                    0x00000001039e4d08 (anonymous namespace)::Verifier::verifyConformance(swift::Decl*, swift::ProtocolConformance*) + 2216
7  swift                    0x00000001039dc13e (anonymous namespace)::Verifier::walkToDeclPost(swift::Decl*) + 5086
8  swift                    0x00000001039e8444 (anonymous namespace)::Traversal::doIt(swift::Decl*) + 2468
9  swift                    0x00000001039e7a8b swift::Decl::walk(swift::ASTWalker&) + 27
10 swift                    0x0000000103a8f53a swift::SourceFile::walk(swift::ASTWalker&) + 170
11 swift                    0x00000001039d3e8b swift::verify(swift::SourceFile&) + 59
12 swift                    0x00000001037a5ec4 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int, unsigned int, unsigned int) + 2036

cc @huonw

@jckarter
Copy link
Member

Looks very similar to SR-7002.

@slavapestov
Copy link
Member

No longer crashes.

@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 regression swift 4.1
Projects
None yet
Development

No branches or pull requests

5 participants