Swift: Calling type-parametric getter of final class with non-fixed layout crashes the compiler
| Originator: | rix.rob | ||
| Number: | rdar://17578450 | Date Originated: | 07-Jul-2014 03:37 PM |
| Status: | Open | Resolved: | |
| Product: | Developer Tools | Product Version: | Xcode6-Beta3 (6A254o) |
| Classification: | Serious Bug | Reproducible: | Always |
Summary:
Crash when I use the type-parametric getter of a @final class.
Steps to Reproduce:
1. Write this Box class:
@final class Box<T> {
let value: T
init(_ value: T) {
self.value = value
}
}
func f<T>(box: Box<T>) {
let x = box.value
}
2. Compile it.
Expected Results:
I expected it to compile.
Actual Results:
The compiler crashed.
Regression:
You couldn’t do non-fixed layouts at all in beta 2, so it’s new in that sense.
Workaround: remove `@final`.
Notes:
0 swift 0x000000010779dde8 llvm::sys::PrintStackTrace(__sFILE*) + 40
1 swift 0x000000010779e2d4 SignalHandler(int) + 452
2 libsystem_platform.dylib 0x00007fff8b6965aa _sigtramp + 26
3 libsystem_platform.dylib 0x000000000000001b _sigtramp + 1956027019
4 swift 0x0000000106b6fef7 swift::irgen::IRGenFunction::emitValueWitnessTableRefForMetadata(llvm::Value*) + 71
5 swift 0x0000000106b9610d swift::irgen::emitInitializeWithCopyCall(swift::irgen::IRGenFunction&, llvm::Value*, llvm::Value*, llvm::Value*) + 45
6 swift 0x0000000106bdc96c swift::SILVisitor<(anonymous namespace)::IRGenSILFunction, void>::visit(swift::ValueBase*) + 39260
7 swift 0x0000000106bd2800 swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 8896
8 swift 0x0000000106b53d18 swift::irgen::IRGenModule::emitGlobalTopLevel() + 200
9 swift 0x0000000106bbf575 performIRGeneration(swift::IRGenOptions&, swift::Module*, swift::SILModule*, llvm::StringRef, llvm::LLVMContext&, swift::SourceFile*, unsigned int) + 1829
10 swift 0x0000000106bbee3a swift::performIRGeneration(swift::IRGenOptions&, swift::Module*, swift::SILModule*, llvm::StringRef, llvm::LLVMContext&) + 42
11 swift 0x0000000106cfb130 swift::RunImmediately(swift::CompilerInstance&, std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&, swift::IRGenOptions&, swift::SILOptions const&) + 128
12 swift 0x0000000106b31cd3 frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 5283
13 swift 0x0000000106b3081d main + 1533
14 libdyld.dylib 0x00007fff94bc25fd start + 1
15 libdyld.dylib 0x000000000000000b start + 1799608847
Stack dump:
0. Program arguments: /Applications/Xcode6-Beta3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -i ./Test.swift -enable-objc-attr-requires-objc-module -target x86_64-apple-darwin13.3.0 -module-name Test -sdk /Applications/Xcode6-Beta3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk
1. While emitting IR SIL function @_TF4Test1fU__FGCS_3BoxQ__T_ for 'f' at ./Test.swift:11:1
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!