Uploaded image for project: 'Swift'
  1. Swift
  2. SR-7633

Compiler crash (Segmentation Fault 11) when assigning protocol method to variable

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Medium
    • Resolution: Duplicate
    • Component/s: Compiler
    • Environment:

      Swift 4.1, 4.1.1 beta, and master (8eb34abee72abb06fb0fb6c9e22e79ebf5b3024f) are affected

      Description

      The following code will currently crash the compiler:

      protocol OhNo {
          func whoops()
      }
      let crash = OhNo.whoops
      

      Output from releaseAssert build:

      not existential
      UNREACHABLE executed at /Users/rkunde/private_git/swift_source/swift/lib/SILGen/SILGenConvert.cpp:932!
      0 swift 0x0000000111147f58 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
      1 swift 0x00000001111485e6 SignalHandler(int) + 422
      2 libsystem_platform.dylib 0x00007fff72d6cf5a _sigtramp + 26
      3 libsystem_platform.dylib 000000000000000000 _sigtramp + 2368286912
      4 libsystem_c.dylib 0x00007fff72b0a1ae abort + 127
      5 swift 0x00000001110e1ef0 LLVMInstallFatalErrorHandler + 0
      6 swift 0x000000010df1b897 swift::Lowering::SILGenFunction::emitOpenExistential(swift::SILLocation, swift::Lowering::ManagedValue, swift::ArchetypeType*, swift::SILType, swift::AccessKind) + 823
      7 swift 0x000000010df3fd1e swift::Lowering::SILGenFunction::emitOpenExistentialExprImpl(swift::OpenExistentialExpr*, llvm::function_ref<void (swift::Expr*)>) + 478
      8 swift 0x000000010df4f9f1 swift::Lowering::RValue swift::Lowering::SILGenFunction::emitOpenExistentialExpr<swift::Lowering::RValue, (anonymous namespace)::RValueEmitter::visitOpenExistentialExpr(swift::OpenExistentialExpr*, swift::Lowering::SGFContext)::$_15>(swift::OpenExistentialExpr*, (anonymous namespace)::RValueEmitter::visitOpenExistentialExpr(swift::OpenExistentialExpr*, swift::Lowering::SGFContext)::$_15) + 65
      9 swift 0x000000010df45f08 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 19384
      10 swift 0x000000010df310cf swift::Lowering::SILGenFunction::emitExprInto(swift::Expr*, swift::Lowering::Initialization*, llvm::Optional<swift::SILLocation>) + 319
      11 swift 0x000000010df209e4 swift::Lowering::SILGenFunction::emitPatternBinding(swift::PatternBindingDecl*, unsigned int) + 292
      12 swift 0x000000010df20c2d swift::Lowering::SILGenFunction::visitPatternBindingDecl(swift::PatternBindingDecl*) + 45
      13 swift 0x000000010ded52b9 swift::Lowering::SILGenModule::visitTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 313
      14 swift 0x000000010ded5afb swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*, unsigned int) + 827
      15 swift 0x000000010ded6860 swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*, llvm::Optional<unsigned int>, bool) + 352
      16 swift 0x000000010ded6e6f swift::performSILGeneration(swift::FileUnit&, swift::SILOptions&, llvm::Optional<unsigned int>) + 95
      17 swift 0x000000010d7667cd performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 8621
      18 swift 0x000000010d763616 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3318
      19 swift 0x000000010d72026d main + 2317
      20 libdyld.dylib 0x00007fff72a5e015 start + 1
      Stack dump:
      0.	Program arguments: /Users/rkunde/private_git/swift_source/build/Ninja-ReleaseAssert/swift-macosx-x86_64/bin/swift -frontend -c -primary-file /Users/rkunde/crash.swift -target x86_64-apple-darwin17.5.0 -enable-objc-interop -color-diagnostics -module-name crash -o /var/folders/hd/862mpr452tzd7_hz00mfmk6c0000gn/T/crash-4eb0ee.o
      <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)

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              rkunde Robin Kunde
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: