Swift compiler crashes

Originator:pzhivkov
Number:rdar://20494437 Date Originated:4/10/2015
Status:Open Resolved:NO
Product:Developer Tools / Xcode Product Version:6.3.1
Classification:Crash Reproducible:Yes
 
The following code causes the most recent Swift compiler to crash:

protocol ExecutionContext {}
class ExecutionContextImpl: ExecutionContext {}
let defaultExecutionContext: ExecutionContext = ExecutionContextImpl()

class Future {
    func onSuccess() {
        onComplete(defaultExecutionContext)
    }
    func onComplete(_ executionContext: ExecutionContext = defaultExecutionContext) {}
}


The crash appears to be related to using a default function parameter that is a protocol.


Expected Results:
Should either compile or exit with a valid error message.

Actual Results:
Segmentation fault: 11

1. While emitting SIL for 'onSuccess' at /Users/pzh/Dev/crash/Concurrency/Future.swift:21:5

0  swift                    0x0000000106b65a08 llvm::sys::PrintStackTrace(__sFILE*) + 40
1  swift                    0x0000000106b65ee4 SignalHandler(int) + 452
2  libsystem_platform.dylib 0x00007fff8ac3ef1a _sigtramp + 26
3  libsystem_platform.dylib 0x00007fc67109e970 _sigtramp + 3863345776
4  swift                    0x00000001065fdf2e (anonymous namespace)::Transform::transform(swift::Lowering::ManagedValue, swift::Lowering::AbstractionPattern, swift::CanType, swift::Lowering::SGFContext) + 494
5  swift                    0x00000001065fe618 swift::Lowering::SILGenFunction::emitSubstToOrigValue(swift::SILLocation, swift::Lowering::ManagedValue, swift::Lowering::AbstractionPattern, swift::CanType, swift::Lowering::SGFContext) + 56
6  swift                    0x00000001065996ef swift::Lowering::ArgumentSource::forwardInto(swift::Lowering::SILGenFunction&, swift::Lowering::AbstractionPattern, swift::Lowering::Initialization*, swift::Lowering::TypeLowering const&) && + 559
7  swift                    0x000000010659947f swift::Lowering::ArgumentSource::materialize(swift::Lowering::SILGenFunction&, swift::Lowering::AbstractionPattern, swift::SILType) && + 415
8  swift                    0x00000001065ae633 (anonymous namespace)::ArgEmitter::emit(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 1315
9  swift                    0x00000001065b0097 (anonymous namespace)::ArgEmitter::emitShuffle(swift::Expr*, swift::Expr*, llvm::ArrayRef<swift::TupleTypeElt>, swift::ConcreteDeclRef, llvm::ArrayRef<swift::Expr*>, llvm::ArrayRef<int>, swift::Type, swift::Lowering::AbstractionPattern) + 2839
10 swift                    0x00000001065af373 (anonymous namespace)::ArgEmitter::emitExpanded(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 2387
...

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!