Swift 2b4: using static property in extension of protocol crashes swiftc

Originator:rix.rob
Number:rdar://22041787 Date Originated:28-Jul-2015 07:40 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode-beta (7A165t)
Classification:Crash/Hang/Data Loss Reproducible:Always
 
Summary:
See above

Steps to Reproduce:
This code:
protocol P {
	init()
}
extension P {
	static var p: Self { return Self() }
}
struct S: P {
	init() {}
}
_ = S.p


Expected Results:
should not crash swiftc

Actual Results:
but totally does: 
TYPE MISMATCH IN ARGUMENT 0 OF APPLY AT expression at [boom.swift:10:5 - line:10:7] RangeText="S.p"
  argument value:   %4 = metatype $@thin S.Type
  parameter type: @thick S.Type
0  swift                    0x0000000106fefb8b llvm::sys::PrintStackTrace(__sFILE*) + 43
1  swift                    0x0000000106ff02cb SignalHandler(int) + 379
2  libsystem_platform.dylib 0x00007fff86e08f1a _sigtramp + 26
3  swift                    0x00000001075eea87 FirstTarget + 61919
4  swift                    0x0000000106ff00c6 abort + 22
5  swift                    0x00000001051e64ff swift::Lowering::SILGenFunction::emitApply(swift::SILLocation, swift::Lowering::ManagedValue, llvm::ArrayRef<swift::Substitution>, llvm::ArrayRef<swift::Lowering::ManagedValue>, swift::CanTypeWrapper<swift::SILFunctionType>, swift::Lowering::AbstractionPattern, swift::CanType, swift::Lowering::ApplyOptions, llvm::Optional<swift::SILFunctionTypeRepresentation>, llvm::Optional<swift::ForeignErrorConvention> const&, swift::Lowering::SGFContext) + 6415
6  swift                    0x00000001051e80e4 (anonymous namespace)::CallEmission::apply(swift::Lowering::SGFContext) + 4052
7  swift                    0x00000001051ebf98 swift::Lowering::SILGenFunction::emitGetAccessor(swift::SILLocation, swift::SILDeclRef, llvm::ArrayRef<swift::Substitution>, swift::Lowering::ArgumentSource&&, bool, bool, swift::Lowering::RValue&&, swift::Lowering::SGFContext) + 664
8  swift                    0x000000010524e7b0 (anonymous namespace)::GetterSetterComponent::get(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::ManagedValue, swift::Lowering::SGFContext) && + 256
9  swift                    0x000000010524b4e9 swift::Lowering::SILGenFunction::emitLoadOfLValue(swift::SILLocation, swift::Lowering::LValue&&, swift::Lowering::SGFContext, bool) + 441
10 swift                    0x000000010522d322 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 25714
11 swift                    0x0000000105224acd swift::Lowering::SILGenFunction::emitIgnoredExpr(swift::Expr*) + 445
12 swift                    0x000000010522a0ca swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 12826
13 swift                    0x0000000105224acd swift::Lowering::SILGenFunction::emitIgnoredExpr(swift::Expr*) + 445
14 swift                    0x0000000105274318 swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 536
15 swift                    0x0000000105277aac swift::Lowering::SILGenModule::visitTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 44
16 swift                    0x00000001051dd14b swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*, unsigned int) + 587
17 swift                    0x00000001051ddfdf swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*, llvm::Optional<unsigned int>, bool, bool) + 975
18 swift                    0x00000001051de43b swift::performSILGeneration(swift::FileUnit&, swift::SILOptions&, llvm::Optional<unsigned int>, bool) + 123
19 swift                    0x0000000104fd5c61 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&) + 9569
20 swift                    0x0000000104fd34e3 frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2627
21 swift                    0x0000000104fcf5af main + 2015
22 libdyld.dylib            0x00007fff86cb45c9 start + 1
23 libdyld.dylib            0x000000000000000d start + 2033498693
Stack dump:
0.	Program arguments: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file boom.swift -target x86_64-apple-darwin14.4.0 -enable-objc-interop -color-diagnostics -module-name boom -o /var/folders/9y/f7n4rvx901nctm_5d16c1wm40000gn/T/boom-19d919.o 
<unknown>:0: error: unable to execute command: Illegal instruction: 4
<unknown>:0: error: swift frontend command failed due to signal (use -v to see invocation)


Process:               swift [31714]
Path:                  /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift
Identifier:            swift
Version:               700.0.47.4
Code Type:             X86-64 (Native)
Parent Process:        swift [31713]
Responsible:           Terminal [31214]
User ID:               501

Date/Time:             2015-07-28 19:39:32.505 -0400
OS Version:            Mac OS X 10.10.4 (14E46)
Report Version:        11
Anonymous UUID:        A6D824E3-4667-F356-07EE-321CCB42BAAA


Time Awake Since Boot: 38000 seconds

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes:       0x0000000000000001, 0x0000000000000000

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   swift                         	0x0000000106ff00d0 abort + 32
1   swift                         	0x00000001051e64ff swift::Lowering::SILGenFunction::emitApply(swift::SILLocation, swift::Lowering::ManagedValue, llvm::ArrayRef<swift::Substitution>, llvm::ArrayRef<swift::Lowering::ManagedValue>, swift::CanTypeWrapper<swift::SILFunctionType>, swift::Lowering::AbstractionPattern, swift::CanType, swift::Lowering::ApplyOptions, llvm::Optional<swift::SILFunctionTypeRepresentation>, llvm::Optional<swift::ForeignErrorConvention> const&, swift::Lowering::SGFContext) + 6415
2   swift                         	0x00000001051e80e4 (anonymous namespace)::CallEmission::apply(swift::Lowering::SGFContext) + 4052
3   swift                         	0x00000001051ebf98 swift::Lowering::SILGenFunction::emitGetAccessor(swift::SILLocation, swift::SILDeclRef, llvm::ArrayRef<swift::Substitution>, swift::Lowering::ArgumentSource&&, bool, bool, swift::Lowering::RValue&&, swift::Lowering::SGFContext) + 664
4   swift                         	0x000000010524e7b0 (anonymous namespace)::GetterSetterComponent::get(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::ManagedValue, swift::Lowering::SGFContext) && + 256
5   swift                         	0x000000010524b4e9 swift::Lowering::SILGenFunction::emitLoadOfLValue(swift::SILLocation, swift::Lowering::LValue&&, swift::Lowering::SGFContext, bool) + 441
6   swift                         	0x000000010522d322 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 25714
7   swift                         	0x0000000105224acd swift::Lowering::SILGenFunction::emitIgnoredExpr(swift::Expr*) + 445
8   swift                         	0x000000010522a0ca swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 12826
9   swift                         	0x0000000105224acd swift::Lowering::SILGenFunction::emitIgnoredExpr(swift::Expr*) + 445
10  swift                         	0x0000000105274318 swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 536
11  swift                         	0x0000000105277aac swift::Lowering::SILGenModule::visitTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 44
12  swift                         	0x00000001051dd14b swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*, unsigned int) + 587
13  swift                         	0x00000001051ddfdf swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*, llvm::Optional<unsigned int>, bool, bool) + 975
14  swift                         	0x00000001051de43b swift::performSILGeneration(swift::FileUnit&, swift::SILOptions&, llvm::Optional<unsigned int>, bool) + 123
15  swift                         	0x0000000104fd5c61 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&) + 9569
16  swift                         	0x0000000104fd34e3 frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2627
17  swift                         	0x0000000104fcf5af main + 2015
18  libdyld.dylib                 	0x00007fff86cb45c9 start + 1

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x0000000000000000  rbx: 0x00000001075ded88  rcx: 0x00007fff8f53248a  rdx: 0xffffffffffffffff
  rdi: 0x000000000000003c  rsi: 0x0000000000000000  rbp: 0x00007fff5ac307c0  rsp: 0x00007fff5ac307c0
   r8: 0x0000000000000000   r9: 0x00000000000f4240  r10: 0x0000000000000001  r11: 0x0000000000000247
  r12: 0x00007f8f410df870  r13: 0x00007f8f410dfab8  r14: 0x00007fff5ac30d38  r15: 0x0000000000000001
  rip: 0x0000000106ff00d0  rfl: 0x0000000000010202  cr2: 0x00007fe324002000
  
Logical CPU:     2
Error Code:      0x00000000
Trap Number:     6


Binary Images:
       0x104fca000 -        0x107405ff7 +swift (700.0.47.4) <9BE42CD4-3386-3F7F-BD2C-68EF87AFCE95> /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift
       0x107e3b000 -        0x107e59fff  libedit.3.dylib (40) <6049084C-478A-3A89-A9A1-E641B5F8C1A7> /usr/lib/libedit.3.dylib
    0x7fff69c1e000 -     0x7fff69c54837  dyld (353.2.1) <72A99D0F-0B56-3938-ABC5-67A0F33757C4> /usr/lib/dyld
    0x7fff843f7000 -     0x7fff843f9fff  libsystem_sandbox.dylib (358.20.5) <3F5E973F-C702-31AC-97BC-05F5C195683C> /usr/lib/system/libsystem_sandbox.dylib
    0x7fff86cb1000 -     0x7fff86cb4ff7  libdyld.dylib (353.2.1) <78E8F33D-0C86-3DB6-A93D-B67A25BA3522> /usr/lib/system/libdyld.dylib
    0x7fff86e04000 -     0x7fff86e0cfff  libsystem_platform.dylib (63) <64E34079-D712-3D66-9CE2-418624A5C040> /usr/lib/system/libsystem_platform.dylib
    0x7fff86e78000 -     0x7fff86e7afff  libquarantine.dylib (76.20.1) <7AF90041-2768-378A-925A-D83161863642> /usr/lib/system/libquarantine.dylib
    0x7fff86e7b000 -     0x7fff86e7cffb  libremovefile.dylib (35) <3485B5F4-6CE8-3C62-8DFD-8736ED6E8531> /usr/lib/system/libremovefile.dylib
    0x7fff86faa000 -     0x7fff871a446f  libobjc.A.dylib (647) <759E155D-BC42-3D4E-869B-6F57D477177C> /usr/lib/libobjc.A.dylib
    0x7fff872be000 -     0x7fff872c3ff7  libmacho.dylib (862) <126CA2ED-DE91-308F-8881-B9DAEC3C63B6> /usr/lib/system/libmacho.dylib
    0x7fff872d0000 -     0x7fff872d0ff7  libunc.dylib (29) <5676F7EA-C1DF-329F-B006-D2C3022B7D70> /usr/lib/system/libunc.dylib
    0x7fff872d6000 -     0x7fff872fefff  libxpc.dylib (559.30.1) <80D68997-17B9-32B6-A5FA-A218216415E5> /usr/lib/system/libxpc.dylib
    0x7fff87b32000 -     0x7fff87b33ff7  libsystem_blocks.dylib (65) <9615D10A-FCA7-3BE4-AA1A-1B195DACE1A1> /usr/lib/system/libsystem_blocks.dylib
    0x7fff87b57000 -     0x7fff87b59ff7  libsystem_coreservices.dylib (9) <41B7C578-5A53-31C8-A96F-C73E030B0938> /usr/lib/system/libsystem_coreservices.dylib
    0x7fff87b5d000 -     0x7fff87ef5ff7  com.apple.CoreFoundation (6.9 - 1153.18) <5C0892B8-9691-341F-9279-CA3A74D59AA0> /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
    0x7fff88301000 -     0x7fff88309ffb  libcopyfile.dylib (118.1.2) <0C68D3A6-ACDD-3EF3-991A-CC82C32AB836> /usr/lib/system/libcopyfile.dylib
    0x7fff88fc8000 -     0x7fff88fd1ff7  libsystem_notify.dylib (133.1.1) <61147800-F320-3DAA-850C-BADF33855F29> /usr/lib/system/libsystem_notify.dylib
    0x7fff88ff5000 -     0x7fff8901fff7  libdispatch.dylib (442.1.4) <502CF32B-669B-3709-8862-08188225E4F0> /usr/lib/system/libdispatch.dylib
    0x7fff89475000 -     0x7fff89486ff3  libsystem_coretls.dylib (35.30.2) <0F7BAD0C-FC28-3E4B-8D21-06B426599043> /usr/lib/system/libsystem_coretls.dylib
    0x7fff89e58000 -     0x7fff89e59fff  libDiagnosticMessagesClient.dylib (100) <2EE8E436-5CDC-34C5-9959-5BA218D507FB> /usr/lib/libDiagnosticMessagesClient.dylib
    0x7fff8b1c3000 -     0x7fff8b217fff  libc++.1.dylib (120) <1B9530FD-989B-3174-BB1C-BDC159501710> /usr/lib/libc++.1.dylib
    0x7fff8b3d4000 -     0x7fff8b3d5ff3  libSystem.B.dylib (1213) <AD223AEB-237D-35A3-825E-EECF95916838> /usr/lib/libSystem.B.dylib
    0x7fff8e682000 -     0x7fff8e684fff  libsystem_configuration.dylib (699.30.1) <B124CC64-59B9-354F-A693-B3431ADB87AC> /usr/lib/system/libsystem_configuration.dylib
    0x7fff8eaf7000 -     0x7fff8eb13ff7  libsystem_malloc.dylib (53.30.1) <DDA8928B-CC0D-3255-BD8A-3FEA0982B890> /usr/lib/system/libsystem_malloc.dylib
    0x7fff8f499000 -     0x7fff8f512fe7  libcorecrypto.dylib (233.30.1) <5779FFA0-4D9A-3AD4-B7F2-618227621DC8> /usr/lib/system/libcorecrypto.dylib
    0x7fff8f515000 -     0x7fff8f51aff7  libunwind.dylib (35.3) <BE7E51A0-B6EA-3A54-9CCA-9D88F683A6D6> /usr/lib/system/libunwind.dylib
    0x7fff8f51c000 -     0x7fff8f539fff  libsystem_kernel.dylib (2782.30.5) <101D28C0-AF07-3B81-87BE-CA27ADED33AB> /usr/lib/system/libsystem_kernel.dylib
    0x7fff8f967000 -     0x7fff8f96bfff  libcache.dylib (69) <45E9A2E7-99C4-36B2-BEE3-0C4E11614AD1> /usr/lib/system/libcache.dylib
    0x7fff8f9a8000 -     0x7fff8f9beff7  libsystem_asl.dylib (267) <F153AC5B-0542-356E-88C8-20A62CA704E2> /usr/lib/system/libsystem_asl.dylib
    0x7fff8fb13000 -     0x7fff8fb43fff  libsystem_m.dylib (3086.1) <1E12AB45-6D96-36D0-A226-F24D9FB0D9D6> /usr/lib/system/libsystem_m.dylib
    0x7fff8fdbf000 -     0x7fff8fde7fff  libsystem_info.dylib (459.20.1) <AEB3FE62-4763-3050-8352-D6F9AF961AE6> /usr/lib/system/libsystem_info.dylib
    0x7fff8fe44000 -     0x7fff8fe4bff7  libcompiler_rt.dylib (35) <BF8FC133-EE10-3DA6-9B90-92039E28678F> /usr/lib/system/libcompiler_rt.dylib
    0x7fff9034a000 -     0x7fff9052fff7  libicucore.A.dylib (531.48) <3CD34752-B1F9-31D2-865D-B5B0F0BE3111> /usr/lib/libicucore.A.dylib
    0x7fff90586000 -     0x7fff90612ff7  libsystem_c.dylib (1044.10.1) <86FBED7A-F2C8-3591-AD6F-486DD57E6B6A> /usr/lib/system/libsystem_c.dylib
    0x7fff90b0e000 -     0x7fff90b1fff7  libz.1.dylib (55) <88C7C7DE-04B8-316F-8B74-ACD9F3DE1AA1> /usr/lib/libz.1.dylib
    0x7fff911fc000 -     0x7fff911fcff7  libkeymgr.dylib (28) <77845842-DE70-3CC5-BD01-C3D14227CED5> /usr/lib/system/libkeymgr.dylib
    0x7fff918c6000 -     0x7fff918cbfff  libsystem_stats.dylib (163.30.2) <48A9387D-5C63-3E79-979C-F675552F6FC9> /usr/lib/system/libsystem_stats.dylib
    0x7fff9194d000 -     0x7fff91953fff  libsystem_trace.dylib (72.20.1) <840F5301-B55A-3078-90B9-FEFFD6CD741A> /usr/lib/system/libsystem_trace.dylib
    0x7fff91954000 -     0x7fff9197ffff  libc++abi.dylib (125) <88A22A0F-87C6-3002-BFBA-AC0F2808B8B9> /usr/lib/libc++abi.dylib
    0x7fff927c8000 -     0x7fff92800fff  libsystem_network.dylib (412.20.3) <6105C134-6722-3C0A-A4CE-5E1261E2E1CC> /usr/lib/system/libsystem_network.dylib
    0x7fff92bf8000 -     0x7fff92bf8ff7  liblaunch.dylib (559.30.1) <B1301610-D60C-3301-B254-11F066BD48A7> /usr/lib/system/liblaunch.dylib
    0x7fff92bf9000 -     0x7fff92c3fff7  libauto.dylib (186) <A260789B-D4D8-316A-9490-254767B8A5F1> /usr/lib/libauto.dylib
    0x7fff93391000 -     0x7fff9339afff  libsystem_pthread.dylib (105.10.1) <3103AA7F-3BAE-3673-9649-47FFD7E15C97> /usr/lib/system/libsystem_pthread.dylib
    0x7fff93599000 -     0x7fff9359afff  libsystem_secinit.dylib (18) <581DAD0F-6B63-3A48-B63B-917AF799ABAA> /usr/lib/system/libsystem_secinit.dylib
    0x7fff935da000 -     0x7fff935e2fff  libsystem_dnssd.dylib (576.30.4) <4EA2DEC3-77EE-3941-A703-DE6DC2056B15> /usr/lib/system/libsystem_dnssd.dylib
    0x7fff93957000 -     0x7fff93987ff7  libncurses.5.4.dylib (44) <F09809A4-53B9-3E91-A8FA-D3F584C03AA3> /usr/lib/libncurses.5.4.dylib
    0x7fff93b63000 -     0x7fff93b69ff7  libsystem_networkextension.dylib (167.30.1) <3E99FF35-DCBB-3A4C-8853-F1F39A792D29> /usr/lib/system/libsystem_networkextension.dylib
    0x7fff93b98000 -     0x7fff93ba3fff  libcommonCrypto.dylib (60061.30.1) <E789748D-F9A7-3CFF-B317-90DF348B1E95> /usr/lib/system/libcommonCrypto.dylib

External Modification Summary:
  Calls made by other processes targeting this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by all processes on this machine:
    task_for_pid: 1277389
    thread_create: 0
    thread_set_state: 695

VM Region Summary:
ReadOnly portion of Libraries: Total=127.1M resident=186.9M(147%) swapped_out_or_unallocated=16777216.0T(13842322030592%)
Writable regions: Total=29.3M written=1916K(6%) resident=2516K(8%) swapped_out=0K(0%) unallocated=26.9M(92%)
 
REGION TYPE                      VIRTUAL
===========                      =======
Kernel Alloc Once                     4K
MALLOC                             21.0M
MALLOC (admin)                       16K
STACK GUARD                        56.0M
Stack                              8192K
VM_ALLOCATE                           8K
__DATA                             3096K
__LINKEDIT                         79.2M
__TEXT                             47.9M
__UNICODE                           552K
mapped file                        11.2M
shared memory                         4K
===========                      =======
TOTAL                             226.9M

Model: MacBookPro11,3, BootROM MBP112.0138.B15, 4 processors, Intel Core i7, 2.8 GHz, 16 GB, SMC 2.19f12
Graphics: Intel Iris Pro, Intel Iris Pro, Built-In
Graphics: NVIDIA GeForce GT 750M, NVIDIA GeForce GT 750M, PCIe, 2048 MB
Memory Module: BANK 0/DIMM0, 8 GB, DDR3, 1600 MHz, 0x80AD, 0x484D54343147533641465238412D50422020
Memory Module: BANK 1/DIMM0, 8 GB, DDR3, 1600 MHz, 0x80AD, 0x484D54343147533641465238412D50422020
AirPort: spairport_wireless_card_type_airport_extreme (0x14E4, 0x134), Broadcom BCM43xx 1.0 (7.15.166.24.3)
Bluetooth: Version 4.3.5f8 15969, 3 services, 27 devices, 1 incoming serial ports
Network Service: Wi-Fi, AirPort, en0
Serial ATA Device: APPLE SSD SM1024F, 1 TB
USB Device: Internal Memory Card Reader
USB Device: BRCM20702 Hub
USB Device: Bluetooth USB Host Controller
USB Device: Apple Internal Keyboard / Trackpad
Thunderbolt Bus: MacBook Pro, Apple Inc., 17.1

Regression:
Static functions don’t seem to suffer the same fate.

Notes:
N/A

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!