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-10815] Protocol method partial application seg fault #53205

Closed
Agarunov opened this issue May 31, 2019 · 0 comments
Closed

[SR-10815] Protocol method partial application seg fault #53205

Agarunov opened this issue May 31, 2019 · 0 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.

Comments

@Agarunov
Copy link

Previous ID SR-10815
Radar None
Original Reporter @Agarunov
Type Bug
Status Resolved
Resolution Duplicate
Environment

Xcode 10.2.1, Swift 5

Additional Detail from JIRA
Votes 0
Component/s
Labels Bug
Assignee None
Priority Medium

md5: 8d406e86fdf8c29125f9f8eae900c2e1

duplicates:

  • SR-75 Referencing a protocol function crashes the compiler

Issue 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
@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 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.
Projects
None yet
Development

No branches or pull requests

1 participant