swiftc segfaults when compiling NSObject subclass with Error property

Originator:prachi
Number:rdar://27671078 Date Originated:02-Aug-2016
Status:Duplicate Resolved:
Product:Developer Tools Product Version:Xcode Version 8.0 beta 4 (8S188o)
Classification:Crash Reproducible:Always
 
Summary:
When compiling an NSObject subclass that has a property of type Error, swiftc segfaults

Steps to Reproduce:
1. Attempt to compile the following file using swiftc:

import Foundation

enum ErrorSubtype : Error {
    case case1
}

class Class : NSObject {
    var error: ErrorSubtype = .case1
}


Expected Results:
The source file compiles successfully.

Actual Results:
swiftc segfaults with the following output:

Apple Swift version 3.0 (swiftlang-800.0.41.2 clang-800.0.36)
Target: x86_64-apple-macosx10.9
/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file TestCase.swift -target x86_64-apple-macosx10.9 -enable-objc-interop -sdk /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -color-diagnostics -module-name TestCase -o /var/folders/wk/mq7_x1yd5691nbczhdt2_f400000gn/T/TestCase-b7183d.o
0  swift                    0x0000000110a3ae3d PrintStackTraceSignalHandler(void*) + 45
1  swift                    0x0000000110a3a886 SignalHandler(int) + 470
2  libsystem_platform.dylib 0x00007fff9815a52a _sigtramp + 26
3  libsystem_platform.dylib 0x00007fff51f62ec0 _sigtramp + 3118500272
4  swift                    0x000000011037aad9 llvm::ValueEnumerator::EnumerateOperandType(llvm::Value const*) + 25
5  swift                    0x00000001103843d8 llvm::ValueEnumerator::ValueEnumerator(llvm::Module const&, bool) + 4584
6  swift                    0x0000000110378411 llvm::WriteBitcodeToFile(llvm::Module const*, llvm::raw_ostream&, bool, llvm::ModuleSummaryIndex const*, bool) + 369
7  swift                    0x000000010de42748 performLLVM(swift::IRGenOptions&, swift::DiagnosticEngine&, llvm::sys::SmartMutex<false>*, llvm::GlobalVariable*, llvm::Module*, llvm::TargetMachine*, llvm::StringRef) + 216
8  swift                    0x000000010de41f32 performIRGeneration(swift::IRGenOptions&, swift::ModuleDecl*, swift::SILModule*, llvm::StringRef, llvm::LLVMContext&, swift::SourceFile*, unsigned int) + 2514
9  swift                    0x000000010dd10337 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*) + 23015
10 swift                    0x000000010dd08679 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 18137
11 swift                    0x000000010dcc54a0 main + 10240
12 libdyld.dylib            0x00007fff8bd255ad start + 1
Stack dump:
0.	Program arguments: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file TestCase.swift -target x86_64-apple-macosx10.9 -enable-objc-interop -sdk /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -color-diagnostics -module-name TestCase -o /var/folders/wk/mq7_x1yd5691nbczhdt2_f400000gn/T/TestCase-b7183d.o 
<unknown>:0: error: unable to execute command: Segmentation fault: 11
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)


Version:
Xcode Version 8.0 beta 4 (8S188o)
OS X Version 10.11.6 (15G31)

Notes:
If the class with the Error property is not an NSObject subclass, the crash does not occur.

Configuration:
This occurs consistently on Xcode 8 beta 4 and OS X 10.11.6. Hardware does not appear to be important.

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!