Skip to content

[SR-10446] Swift 5 regression: playground/REPL crash around key paths #52846

@stephencelis

Description

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

Xcode 10.2 / Swift 5

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

md5: 4590729a9a2c64ced4e50c8676d31cb5

duplicates:

  • SR-10117 EXC_BAD_INSTRUCTION in playground

Issue Description:

If you create a playground where the entire contents is:

\String.count

You get a crash:

Fatal error: load from misaligned raw pointer
Playground execution failed:


error: Execution was interrupted, reason: EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0).
The process has been left at the point where it was interrupted, use "thread return -x" to return to the state before expression evaluation.


* thread #​1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_INSTRUCTION (code=EXC_I386_INVOP, subcode=0x0)
  * frame #&#8203;0: 0x00007fff6c5b3483 libswiftCore.dylib`function signature specialization <Arg[0] = Exploded, Arg[1] = Exploded, Arg[2] = Dead, Arg[3] = Dead> of Swift._fatalErrorMessage(_: Swift.StaticString, _: Swift.StaticString, file: Swift.StaticString, line: Swift.UInt, flags: Swift.UInt32) -> Swift.Never + 307
    frame #&#8203;1: 0x00007fff6c4b191a libswiftCore.dylib`generic specialization <Swift.GetKeyPathClassAndInstanceSizeFromPattern> of Swift._walkKeyPathPattern<A where A: Swift.KeyPathPatternVisitor>(_: Swift.UnsafeRawPointer, walker: inout A) -> () + 1370
    frame #&#8203;2: 0x00007fff6c4b0d34 libswiftCore.dylib`Swift._getKeyPathClassAndInstanceSizeFromPattern(Swift.UnsafeRawPointer, Swift.UnsafeRawPointer) -> (keyPathClass: Swift.AnyKeyPath.Type, rootType: Any.Type, size: Swift.Int, alignmentMask: Swift.Int) + 100
    frame #&#8203;3: 0x00007fff6c4b0ae6 libswiftCore.dylib`Swift._swift_getKeyPath(pattern: Swift.UnsafeMutableRawPointer, arguments: Swift.UnsafeRawPointer) -> Swift.UnsafeRawPointer + 118
    frame #&#8203;4: 0x00007fff6c4b0a69 libswiftCore.dylib`swift_getKeyPathImpl + 9
    frame #&#8203;5: 0x000000010f178240 $__lldb_expr127`main at Untitled Page.xcplaygroundpage:4:1
    frame #&#8203;6: 0x000000010c1471b0 com.apple.dt.Xcode.PlaygroundStub-macosx
    frame #&#8203;7: 0x00007fff407cc02c CoreFoundation`__invoking___ + 140
    frame #&#8203;8: 0x00007fff407cbeff CoreFoundation`-[NSInvocation invoke] + 311
    frame #&#8203;9: 0x00007fff4082bd9d CoreFoundation`-[NSInvocation invokeWithTarget:] + 56
    frame #&#8203;10: 0x00007fff685e5bba ViewBridge`__68-[NSVB_ViewServiceImplicitAnimationDecodingProxy forwardInvocation:]_block_invoke_2 + 46
    frame #&#8203;11: 0x00007fff685af8c6 ViewBridge`-[NSViewServiceMarshal withHostWindowFrameAnimationInProgress:perform:] + 53
    frame #&#8203;12: 0x00007fff685e5b83 ViewBridge`__68-[NSVB_ViewServiceImplicitAnimationDecodingProxy forwardInvocation:]_block_invoke + 112
    frame #&#8203;13: 0x00007fff3ded7e4c AppKit`+[NSAnimationContext runAnimationGroup:] + 55
    frame #&#8203;14: 0x00007fff3ded7e02 AppKit`+[NSAnimationContext runAnimationGroup:completionHandler:] + 82
    frame #&#8203;15: 0x00007fff68605904 ViewBridge`runAnimationGroup + 295
    frame #&#8203;16: 0x00007fff685e56de ViewBridge`+[NSVB_View _animateWithAttributes:animations:completion:] + 490
    frame #&#8203;17: 0x00007fff685e5aee ViewBridge`-[NSVB_ViewServiceImplicitAnimationDecodingProxy forwardInvocation:] + 206
    frame #&#8203;18: 0x00007fff40814e2e CoreFoundation`___forwarding___ + 780
    frame #&#8203;19: 0x00007fff40814a98 CoreFoundation`__forwarding_prep_0___ + 120
    frame #&#8203;20: 0x00007fff407cc02c CoreFoundation`__invoking___ + 140
    frame #&#8203;21: 0x00007fff407cbeff CoreFoundation`-[NSInvocation invoke] + 311
    frame #&#8203;22: 0x00007fff4082bd9d CoreFoundation`-[NSInvocation invokeWithTarget:] + 56
    frame #&#8203;23: 0x00007fff685b2088 ViewBridge`-[NSVB_QueueingProxy forwardInvocation:] + 324
    frame #&#8203;24: 0x00007fff40814e2e CoreFoundation`___forwarding___ + 780
    frame #&#8203;25: 0x00007fff40814a98 CoreFoundation`__forwarding_prep_0___ + 120
    frame #&#8203;26: 0x00007fff407cc02c CoreFoundation`__invoking___ + 140
    frame #&#8203;27: 0x00007fff407cbeff CoreFoundation`-[NSInvocation invoke] + 311
    frame #&#8203;28: 0x00007fff4082bd9d CoreFoundation`-[NSInvocation invokeWithTarget:] + 56
    frame #&#8203;29: 0x00007fff40814e2e CoreFoundation`___forwarding___ + 780
    frame #&#8203;30: 0x00007fff40814a98 CoreFoundation`__forwarding_prep_0___ + 120
    frame #&#8203;31: 0x00007fff407cc02c CoreFoundation`__invoking___ + 140
    frame #&#8203;32: 0x00007fff407cbeff CoreFoundation`-[NSInvocation invoke] + 311
    frame #&#8203;33: 0x00007fff68582082 ViewBridge`__deferNSXPCInvocationOntoMainThread_block_invoke + 228
    frame #&#8203;34: 0x00007fff68577814 ViewBridge`__wrapBlockWithVoucher_block_invoke + 37
    frame #&#8203;35: 0x00007fff685775c1 ViewBridge`__deferBlockOntoMainThread_block_invoke_2 + 584
    frame #&#8203;36: 0x00007fff407f96c4 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_BLOCK__ + 12
    frame #&#8203;37: 0x00007fff407bcdd7 CoreFoundation`__CFRunLoopDoBlocks + 394
    frame #&#8203;38: 0x00007fff407bc4f6 CoreFoundation`__CFRunLoopRun + 1174
    frame #&#8203;39: 0x00007fff407bbe0e CoreFoundation`CFRunLoopRunSpecific + 455
    frame #&#8203;40: 0x00007fff3faa89db HIToolbox`RunCurrentEventLoopInMode + 292
    frame #&#8203;41: 0x00007fff3faa861d HIToolbox`ReceiveNextEventCommon + 355
    frame #&#8203;42: 0x00007fff3faa84a6 HIToolbox`_BlockUntilNextEventMatchingListInModeWithFilter + 64
    frame #&#8203;43: 0x00007fff3de42ffb AppKit`_DPSNextEvent + 965
    frame #&#8203;44: 0x00007fff3de41d93 AppKit`-[NSApplication(NSEvent) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 1361
    frame #&#8203;45: 0x00007fff6857fc43 ViewBridge`-[NSViewServiceApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 99
    frame #&#8203;46: 0x00007fff3de3beb0 AppKit`-[NSApplication run] + 699
    frame #&#8203;47: 0x00007fff3de2b3f0 AppKit`NSApplicationMain + 777
    frame #&#8203;48: 0x00007fff6ce68213 libxpc.dylib`_xpc_objc_main + 612
    frame #&#8203;49: 0x00007fff6ce67cd9 libxpc.dylib`xpc_main + 433
    frame #&#8203;50: 0x00007fff685717f0 ViewBridge`-[NSXPCSharedListener resume] + 16
    frame #&#8203;51: 0x00007fff6857a5bc ViewBridge`NSViewServiceApplicationMain + 2830
    frame #&#8203;52: 0x000000010c1471da com.apple.dt.Xcode.PlaygroundStub-macosx`main + 42
    frame #&#8203;53: 0x00007fff6cc353d5 libdyld.dylib`start + 1
    frame #&#8203;54: 0x00007fff6cc353d5 libdyld.dylib`start + 1 

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itselfcrashBug: A crash, i.e., an abnormal termination of softwarerun-time crashBug → crash: Swift code crashed during execution

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions