[Swift] Compiler crash when casting from [Any]? to [String]?

Originator:neocool2
Number:rdar://19920070 Date Originated:23-Feb-2015 01:43 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Apple Swift version 1.2 (swiftlang-602.0.37.3 clang-602.0.37)
Classification:Enhancement Reproducible:Always
 
Summary:

The compiler crashes when compiling this piece of Swift code:

let foo: [Any]? = nil
let bar = foo as? [String]?

Steps to Reproduce:

Compile the Swift code from “Summary”

Expected Results:

Compiles

Actual Results:

The Swift compiler crashes:

0  swift                    0x000000010f936d38 llvm::sys::PrintStackTrace(__sFILE*) + 40
1  swift                    0x000000010f937214 SignalHandler(int) + 452
2  libsystem_platform.dylib 0x00007fff9a6a3f1a _sigtramp + 26
3  libsystem_platform.dylib 0x00007fc0888937a0 _sigtramp + 3995007136
4  swift                    0x000000010f30683d swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 9485
5  swift                    0x000000010f2734ab swift::irgen::IRGenModule::emitGlobalTopLevel() + 155
6  swift                    0x000000010f2f1169 performIRGeneration(swift::IRGenOptions&, swift::Module*, swift::SILModule*, llvm::StringRef, llvm::LLVMContext&, swift::SourceFile*, unsigned int) + 2121
7  swift                    0x000000010f2f1b63 swift::performIRGeneration(swift::IRGenOptions&, swift::SourceFile&, swift::SILModule*, llvm::StringRef, llvm::LLVMContext&, unsigned int) + 51
8  swift                    0x000000010f22f964 frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 10196
9  swift                    0x000000010f22cfe6 main + 1814
10 libdyld.dylib            0x00007fff93ee65c9 start + 1
Stack dump:
0.	Program arguments: /Applications/Xcode-Beta 2.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file yacrash.swift -target x86_64-apple-darwin14.3.0 -enable-objc-interop -sdk /Applications/Xcode-Beta 2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk -color-diagnostics -module-name yacrash -o /var/folders/by/znchwbl51gdfht48wv0m4t6r0000gn/T/yacrash-f8bbe8.o 
1.	While emitting IR SIL function @main<unknown>:0: error: unable to execute command: Segmentation fault: 11
<unknown>:0: error: swift frontend command failed due to signal (use -v to see invocation)

Regression: Same result with Swift 1.1

Notes: -

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!