Swift: Compiler Crash in emitSILFunction With Optional Enum

Originator:wetzeal
Number:rdar://19472840 Date Originated:14-Jan-2015 01:04 PM
Status:Duplicate/18188437/Closed Resolved:
Product:Developer Tools Product Version:Xcode 6.1.1 (6A2006)
Classification:Serious Bug Reproducible:Always
 
Summary:
The following code causes the swift compiler to crash:

enum A  {
    case b
}
let c: A? = .b
let d = (c == .b)


Steps to Reproduce:
Compile the provided code, or run in playground

Expected Results:
The code compiles

Actual Results:
0  swift                    0x0000000108f30b68 llvm::sys::PrintStackTrace(__sFILE*) + 40
1  swift                    0x0000000108f31054 SignalHandler(int) + 452
2  libsystem_platform.dylib 0x00007fff8f991f1a _sigtramp + 26
3  libsystem_malloc.dylib   0x00007fff983884ff szone_free_definite_size + 2432
4  swift                    0x0000000108334d3b swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 9179
5  swift                    0x00000001082ae447 swift::irgen::IRGenModule::emitLazyDefinitions() + 199
6  swift                    0x0000000108321af6 performIRGeneration(swift::IRGenOptions&, swift::Module*, swift::SILModule*, llvm::StringRef, llvm::LLVMContext&, swift::SourceFile*, unsigned int) + 2038
7  swift                    0x0000000108322473 swift::performIRGeneration(swift::IRGenOptions&, swift::SourceFile&, swift::SILModule*, llvm::StringRef, llvm::LLVMContext&, unsigned int) + 51
8  swift                    0x00000001082776f4 frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 5444
9  swift                    0x0000000108274a6d main + 1677
10 libdyld.dylib            0x00007fff8e2135c9 start + 1
Stack dump:
0.	Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file crash.swift -target x86_64-apple-darwin14.1.0 -target-cpu core2 -color-diagnostics -module-name crash -o /var/folders/4d/hpy1g6_94v1__lmgv917rzyc0000gn/T/crash-ae5f51.o
1.	While emitting IR SIL function @top_level_code<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)

Notes:
I also experienced this crash with a computed var of a class with an optional enum type. This stack trace was very close to the one provided.

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!