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

Protocol method partial application seg fault

    XMLWordPrintable

    Details

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

      Xcode 10.2.1, Swift 5

      Description

      Segmentation fault for this code:

      import UIKit
      
      protocol P {
          func doSomething()
      }
      
      @UIApplicationMain
      class AppDelegate: UIResponder, UIApplicationDelegate {
      
          var window: UIWindow?
      
          func application(_ application: UIApplication,
                           didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool
          {
              let f = P.doSomething // here
      
              return true
          }
      
      }
      

      Stacktrace:

      1.	While emitting SIL for 'application(_:didFinishLaunchingWithOptions:)' (at AppDelegate.swift:20:5)
      2.	While silgen emitFunction SIL function "@$s4Test11AppDelegateC11application_29didFinishLaunchingWithOptionsSbSo13UIApplicationC_SDySo0j6LaunchI3KeyaypGSgtF".
       for 'application(_:didFinishLaunchingWithOptions:)' (at AppDelegate.swift:20:5)
      0  swift                    0x0000000112d0eee3 PrintStackTraceSignalHandler(void*) + 51
      1  swift                    0x0000000112d0e6bc SignalHandler(int) + 348
      2  libsystem_platform.dylib 0x00007fff7af67b5d _sigtramp + 29
      3  libsystem_platform.dylib 000000000000000000 _sigtramp + 2231993536
      4  swift                    0x000000010f740b60 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 39344
      5  swift                    0x000000010f7378a8 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 1784
      6  swift                    0x000000010f7386b2 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 5378
      7  swift                    0x000000010f74dd49 void llvm::function_ref<void (swift::Expr*)>::callback_fn<swift::Lowering::RValue swift::Lowering::SILGenFunction::emitOpenExistentialExpr<swift::Lowering::RValue, (anonymous namespace)::RValueEmitter::visitOpenExistentialExpr(swift::OpenExistentialExpr*, swift::Lowering::SGFContext)::$_16>(swift::OpenExistentialExpr*, (anonymous namespace)::RValueEmitter::visitOpenExistentialExpr(swift::OpenExistentialExpr*, swift::Lowering::SGFContext)::$_16)::'lambda'(swift::Expr*)>(long, swift::Expr*) + 41
      8  swift                    0x000000010f74e1ab swift::Lowering::SILGenFunction::emitOpenExistentialExprImpl(swift::OpenExistentialExpr*, llvm::function_ref<void (swift::Expr*)>) + 1003
      9  swift                    0x000000010f73eedb swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 32043
      10 swift                    0x000000010f736fd3 swift::Lowering::SILGenFunction::emitExprInto(swift::Expr*, swift::Lowering::Initialization*, llvm::Optional<swift::SILLocation>) + 131
      11 swift                    0x000000010f72aa6c swift::Lowering::SILGenFunction::emitPatternBinding(swift::PatternBindingDecl*, unsigned int) + 268
      12 swift                    0x000000010f6ca3bd swift::ASTVisitor<swift::Lowering::SILGenFunction, void, void, void, void, void, void>::visit(swift::Decl*) + 141
      13 swift                    0x000000010f7ad34f swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 8431
      14 swift                    0x000000010f763b41 swift::Lowering::SILGenFunction::emitFunction(swift::FuncDecl*) + 433
      15 swift                    0x000000010f6c14d3 swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*) + 995
      16 swift                    0x000000010f7baed5 (anonymous namespace)::SILGenType::emitType() + 261
      17 swift                    0x000000010f6cc67d swift::ASTVisitor<swift::Lowering::SILGenModule, void, void, void, void, void, void>::visit(swift::Decl*) + 77
      18 swift                    0x000000010f6cb856 swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*) + 1206
      19 swift                    0x000000010f6cd66c swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*) + 1228
      20 swift                    0x000000010eb6e7aa performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 30122
      21 swift                    0x000000010eb6392e swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 6862
      22 swift                    0x000000010eb019ce main + 1246
      23 libdyld.dylib            0x00007fff7ad7c3d5 start + 1
      error: Segmentation fault: 11
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              Agarunov Anton Agarunov
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: