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

Compiler crash casting [NSObject:AnyObject] to [NSString:NSString]

    XMLWordPrintable

    Details

      Description

      swiftc crashes on the following code where I am attempting to cast an NSNotification userInfo dictionary to an [NSString:NSString]

      import Foundation
      
      let INPUT_NOTIFICATION = "InputNotification"
      let nc = NSNotificationCenter.defaultCenter()
      
      nc.addObserverForName(INPUT_NOTIFICATION, object:nil, queue:nil) {
        (notification) in
        let userInfo = notification.userInfo as! [NSString:NSString]
      }
      
      swiftc swift_crash.swift   
      0  swift           0x0000000002f3a348 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
      1  swift           0x0000000002f38b16 llvm::sys::RunSignalHandlers() + 54
      2  swift           0x0000000002f3ae7a
      3  libpthread.so.0 0x00007f9dfe2a8340
      4  swift           0x0000000000988d9b
      5  swift           0x000000000098870b swift::Lowering::emitUnconditionalCheckedCast(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Expr*, swift::Type, swift::CheckedCastKind, swift::Lowering::SGFContext) + 139
      6  swift           0x00000000009944c9
      7  swift           0x000000000098c949
      8  swift           0x000000000097d320
      9  swift           0x000000000097d40d
      10 swift           0x00000000009d1b17
      11 swift           0x00000000009d193e
      12 swift           0x00000000009a598e
      13 swift           0x00000000009407f5
      14 swift           0x000000000099f1fa
      15 swift           0x0000000000991b6e
      16 swift           0x000000000098ca84
      17 swift           0x0000000000959b9b
      18 swift           0x000000000095ac15
      19 swift           0x000000000095984b
      20 swift           0x0000000000958fa4
      21 swift           0x000000000094c79b
      22 swift           0x000000000094b1b3
      23 swift           0x0000000000991b2e
      24 swift           0x000000000099083c
      25 swift           0x0000000000943bb9
      26 swift           0x000000000094444b
      27 swift           0x0000000000945162 swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*, llvm::Optional<unsigned int>, bool, bool) + 498
      28 swift           0x00000000009456d6 swift::performSILGeneration(swift::FileUnit&, swift::SILOptions&, llvm::Optional<unsigned int>, bool) + 118
      29 swift           0x0000000000766690
      30 swift           0x0000000000761e62 frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2482
      31 swift           0x000000000075ca41 main + 2705
      32 libc.so.6       0x00007f9dfd4a9ec5 __libc_start_main + 245
      33 swift           0x000000000075bebd
      Stack dump:
      0.	Program arguments: /usr/bin/swift -frontend -c -primary-file swift_crash.swift -target x86_64-unknown-linux-gnu -disable-objc-interop -color-diagnostics -module-name swift_crash -o /tmp/swift_crash-dea395.o 
      1.	While silgen closureexpr SIL function @_TF11swift_crashU_FC10Foundation14NSNotificationT_ for expression at [swift_crash.swift:6:66 - line:9:1] RangeText="{
        (notification) in
        let userInfo = notification.userInfo as! [NSString:NSString]
      }"
      <unknown>:0: error: unable to execute command: Segmentation fault
      <unknown>:0: error: compile command failed due to signal (use -v to see invocation)
      

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              joeiachievedit Joe
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated: