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

Calling default implementation as a curried method causes compiler crash

    XMLWordPrintable

    Details

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

      Description

      protocol P {}
      
      extension P {
          func defaultImplementation() {}
      }
      
      class C : P {
          
          func customImplementation() {
              P.defaultImplementation(self)()
          }
      }
      

      Tested against swift-DEVELOPMENT-SNAPSHOT-2017-01-17-a.

      UNREACHABLE executed at /Users/buildnode/jenkins/workspace/oss-swift-package-osx/swift/lib/SILGen/SILGenConvert.cpp:803!
      0  swift                    0x000000010e838598 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
      1  swift                    0x000000010e837776 llvm::sys::RunSignalHandlers() + 86
      2  swift                    0x000000010e838c39 SignalHandler(int) + 361
      3  libsystem_platform.dylib 0x00007fffc0333bba _sigtramp + 26
      4  libsystem_platform.dylib 0x00007fff54495fa0 _sigtramp + 2484478976
      5  libsystem_c.dylib        0x00007fffc01ba420 abort + 129
      6  swift                    0x000000010e7d1d27 llvm::llvm_unreachable_internal(char const*, char const*, unsigned int) + 471
      7  swift                    0x000000010be8f01e swift::Lowering::SILGenFunction::emitOpenExistential(swift::SILLocation, swift::Lowering::ManagedValue, swift::CanTypeWrapper<swift::ArchetypeType>, swift::SILType) + 926
      8  swift                    0x000000010bea5c42 swift::Lowering::SILGenFunction::emitOpenExistentialExprImpl(swift::OpenExistentialExpr*, llvm::function_ref<void (swift::Expr*)>) + 546
      9  swift                    0x000000010beb20a1 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
      10 swift                    0x000000010bea8db0 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 8736
      11 swift                    0x000000010bea52ed swift::Lowering::SILGenFunction::emitRValueAsSingleValue(swift::Expr*, swift::Lowering::SGFContext) + 61
      12 swift                    0x000000010be6d244 (anonymous namespace)::SILGenApply::visitExpr(swift::Expr*) + 36
      13 swift                    0x000000010be71115 (anonymous namespace)::SILGenApply::visitApplyExpr(swift::ApplyExpr*) + 5013
      14 swift                    0x000000010be71115 (anonymous namespace)::SILGenApply::visitApplyExpr(swift::ApplyExpr*) + 5013
      15 swift                    0x000000010be5c861 prepareApplyExpr(swift::Lowering::SILGenFunction&, swift::Expr*) + 161
      16 swift                    0x000000010be5c795 swift::Lowering::SILGenFunction::emitApplyExpr(swift::Expr*, swift::Lowering::SGFContext) + 37
      17 swift                    0x000000010bea6be5 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 85
      18 swift                    0x000000010bea55b6 swift::Lowering::SILGenFunction::emitIgnoredExpr(swift::Expr*) + 470
      19 swift                    0x000000010bef9dcd swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 653
      20 swift                    0x000000010bef9b35 swift::Lowering::SILGenFunction::emitStmt(swift::Stmt*) + 21
      21 swift                    0x000000010beba40e swift::Lowering::SILGenFunction::emitFunction(swift::FuncDecl*) + 462
      22 swift                    0x000000010be571c8 swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*)::$_1::operator()(swift::SILFunction*) const + 216
      23 swift                    0x000000010be4d930 swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*) + 640
      24 swift                    0x000000010beff22f (anonymous namespace)::SILGenType::emitType() + 959
      25 swift                    0x000000010befee0d swift::Lowering::SILGenModule::visitNominalTypeDecl(swift::NominalTypeDecl*) + 29
      26 swift                    0x000000010be53c3b swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*, unsigned int) + 747
      27 swift                    0x000000010be54ca5 swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*, llvm::Optional<unsigned int>, bool, bool) + 949
      28 swift                    0x000000010be551c5 swift::performSILGeneration(swift::FileUnit&, swift::SILOptions&, llvm::Optional<unsigned int>, bool) + 117
      29 swift                    0x000000010b7b189b swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 13595
      30 swift                    0x000000010b769341 main + 3025
      31 libdyld.dylib            0x00007fffc0126255 start + 1
      Stack dump:
      0.	Program arguments: /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2017-01-17-a.xctoolchain/usr/bin/swift -frontend -c -primary-file /Users/sergej/Desktop/test/test/main.swift -target x86_64-apple-macosx10.9 -enable-objc-interop -color-diagnostics -module-name main -o /var/folders/m2/y2qb_r75011490596v48b1r80000gn/T/main-a29823.o 
      1.	While emitting SIL for 'customImplementation' at /Users/sergej/Desktop/test/test/main.swift:17:5
      <unknown>:0: error: unable to execute command: Abort trap: 6
      <unknown>:0: error: compile command failed due to signal (use -v to see invocation)
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              broadway_lamb Sergej Jaskiewicz
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: