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-10271] Compiler crash during compilation #52671

Open
swift-ci opened this issue Apr 2, 2019 · 1 comment
Open

[SR-10271] Compiler crash during compilation #52671

swift-ci opened this issue Apr 2, 2019 · 1 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 5.0 type checker Area → compiler: Semantic analysis

Comments

@swift-ci
Copy link
Collaborator

swift-ci commented Apr 2, 2019

Previous ID SR-10271
Radar rdar://problem/49560995
Original Reporter JoannisO (JIRA User)
Type Bug

Attachment: Download

Environment

The Swift 5.0 compiler, macOS 10.14.4 using Xcode 10.2.

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

md5: def455ab1fe82f807ae0d9174b37af51

is duplicated by:

  • SR-10429 Compiler crash with conditional conformance to Expressible* protocol

relates to:

  • SR-10429 Compiler crash with conditional conformance to Expressible* protocol

Issue Description:

The attached code crashes during compilation. Removing the conditional conformance solved the compilation issues. Swift 4.2 compiler has no problems compiling this code, but the Swift 5 compiler does. Even when compiling Swift 4.2 modules using the Swift 5 compiler.

@weissi
Copy link
Member

weissi commented Apr 2, 2019

just pasting the whole code here as it's nice and short

final class Binding<T> {
    var currentValue: T

    init(_ initial: T) {
        currentValue = initial
    }
}

extension Binding: ExpressibleByIntegerLiteral where T: ExpressibleByIntegerLiteral {
    typealias IntegerLiteralType = T.IntegerLiteralType

    convenience init(integerLiteral value: IntegerLiteralType) {
        self.init(T(integerLiteral: value))
    }
}

let binding = Binding(0)

and the crasher

$ jw-swift-5.0 swiftc ~/Downloads/main.swift 
checked decl cannot have error type
(var_decl range=[/Users/johannes/Downloads/main.swift:17:5 - line:17:5] "binding" type='<<error type>>' interface type='<<error type>>' access=internal let readImpl=stored immutable)
Stack dump:
0.  Program arguments: /Library/Developer/Toolchains/swift-5.0-RELEASE.xctoolchain/usr/bin/swift -frontend -c -primary-file /Users/johannes/Downloads/main.swift -target x86_64-apple-darwin18.5.0 -enable-objc-interop -sdk /Volumes/Xcode11A301_m19A426z_i17A446z_t17J441z_w17R445z_b17P421z_32bitSupport_FastSim_Boost_37GB/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -color-diagnostics -module-name main -o /var/folders/lj/qfjqv9_x6b972r7l6f49lvmh0000gn/T/main-ce905d.o 
1.  While walking into decl declaration 0x7fd622898ec8 (at /Users/johannes/Downloads/main.swift:17:1)
2.  While verifying VarDecl 'binding' (at /Users/johannes/Downloads/main.swift:17:5)
0  swift                    0x000000010d1ff245 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 37
1  swift                    0x000000010d1fe4e5 llvm::sys::RunSignalHandlers() + 85
2  swift                    0x000000010d1ff832 SignalHandler(int) + 258
3  libsystem_platform.dylib 0x00007fff65365b5d _sigtramp + 29
4  libsystem_platform.dylib 0x0000000119066b76 _sigtramp + 3016757302
5  libsystem_c.dylib        0x00007fff652256a6 abort + 127
6  swift                    0x000000010a8f51ac (anonymous namespace)::Verifier::verifyChecked(swift::ValueDecl*) + 300
7  swift                    0x000000010a8f5706 (anonymous namespace)::Verifier::verifyChecked(swift::VarDecl*) + 1286
8  swift                    0x000000010a8ec5da (anonymous namespace)::Verifier::walkToDeclPost(swift::Decl*) + 3354
9  swift                    0x000000010a8f707b (anonymous namespace)::Traversal::doIt(swift::Decl*) + 251
10 swift                    0x000000010a8faf30 swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Pattern*) + 192
11 swift                    0x000000010a8fbc2e swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Decl*) + 478
12 swift                    0x000000010a8f7057 (anonymous namespace)::Traversal::doIt(swift::Decl*) + 215
13 swift                    0x000000010a8f9e48 swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Stmt*) + 472
14 swift                    0x000000010a8fbb3a swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Decl*) + 234
15 swift                    0x000000010a8f7057 (anonymous namespace)::Traversal::doIt(swift::Decl*) + 215
16 swift                    0x000000010a8f6f6b swift::Decl::walk(swift::ASTWalker&) + 27
17 swift                    0x000000010a9b396a swift::SourceFile::walk(swift::ASTWalker&) + 170
18 swift                    0x000000010a8e250b swift::verify(swift::SourceFile&) + 59
19 swift                    0x000000010a6a557a swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) + 1370
20 swift                    0x0000000109e60ce6 swift::CompilerInstance::parseAndTypeCheckMainFileUpTo(swift::SourceFile::ASTStage_t, swift::PersistentParserState&, swift::DelayedParsingCallbacks*, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>) + 502
21 swift                    0x0000000109e5f663 swift::CompilerInstance::parseAndCheckTypesUpTo(swift::CompilerInstance::ImplicitImports const&, swift::SourceFile::ASTStage_t) + 435
22 swift                    0x0000000109e5ed17 swift::CompilerInstance::performSemaUpTo(swift::SourceFile::ASTStage_t) + 615
23 swift                    0x000000010963f188 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 1192
24 swift                    0x000000010963dc78 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3016
25 swift                    0x00000001095efd52 main + 690
26 libdyld.dylib            0x00007fff651803d5 start + 1
27 libdyld.dylib            0x000000000000000f start + 2598894651
<unknown>:0: error: unable to execute command: Abort trap: 6
<unknown>:0: error: compile command failed due to signal 6 (use -v to see invocation)

@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
@AnthonyLatsis AnthonyLatsis added the type checker Area → compiler: Semantic analysis label Dec 22, 2022
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 5.0 type checker Area → compiler: Semantic analysis
Projects
None yet
Development

No branches or pull requests

3 participants