You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
lilyballmannequin opened this issue
Oct 22, 2019
· 4 comments
Labels
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler in itselfcrashBug: A crash, i.e., an abnormal termination of software
Apple Swift version 5.1 (swiftlang-1100.0.270.13 clang-1100.0.33.7)
Target: x86_64-apple-darwin19.0.0
Additional Detail from JIRA
Votes
0
Component/s
Compiler
Labels
Bug, CompilerCrash
Assignee
None
Priority
Medium
md5: da7d5242311cc91d2247bffdb21794bb
relates to:
SR-11651 Extension of generic Obj-C type has confusing note about adding @objc
Issue Description:
If I try to extend a generic Obj-C type from Swift with a new method, I get an error about how generic parameters aren't available at runtime. If I add the @objc attribute this error goes away, but instead I get a compiler crash.
import Foundation
extensionNSHashTable{@objcfunc foo(_ x:ObjectType){}}
Stack dump:
0. Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file foo.swift -target x86_64-apple-darwin19.0.0 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -color-diagnostics -module-name foo -o /var/folders/nq/dmc1zzf938163pj2rm8tcrbr0000gn/T/foo-8e6b0c.o
1. While emitting IR SIL function "@$sSo11NSHashTableC3fooEACyyxF".
for 'foo(_:)' (at foo.swift:3:11)
0 swift 0x000000010da26eb3 PrintStackTraceSignalHandler(void*) + 51
1 swift 0x000000010da26686 SignalHandler(int) + 358
2 libsystem_platform.dylib 0x00007fff6e5d3b1d _sigtramp + 29
3 swift 0x00000001098802bd swift::Type llvm::function_ref<swift::Type (swift::SubstitutableType*)>::callback_fn<swift::irgen::TypeConverter::getExemplarType(swift::CanType)::$_0>(long, swift::SubstitutableType*) + 221
4 swift 0x0000000109905ed5 emitDirectTypeMetadataRef(swift::irgen::IRGenFunction&, swift::CanType, swift::irgen::DynamicMetadataRequest) + 197
5 swift 0x000000010990a7c5 swift::irgen::IRGenFunction::emitTypeMetadataRef(swift::CanType, swift::irgen::DynamicMetadataRequest) + 149
6 swift 0x00000001098d92d3 void llvm::function_ref<void (swift::CanType)>::callback_fn<(anonymous namespace)::IRGenSILFunction::bindArchetypes(swift::Type)::'lambda'(swift::CanType)>(long, swift::CanType) + 67
7 swift 0x000000010976729d bool llvm::function_ref<bool (swift::CanType)>::callback_fn<swift::CanType::visit(llvm::function_ref<void (swift::CanType)>) const::'lambda'(swift::Type)>(long, swift::CanType) + 13
8 swift 0x000000010a61851e swift::Type::findIf(llvm::function_ref<bool (swift::Type)>) const::Walker::walkToTypePre(swift::Type) + 14
9 swift 0x00000001098d257b (anonymous namespace)::IRGenSILFunction::bindArchetypes(swift::Type) + 235
10 swift 0x00000001098cdd20 swift::SILInstructionVisitor<(anonymous namespace)::IRGenSILFunction, void>::visit(swift::SILInstruction*) + 90240
11 swift 0x00000001098b512a swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 9866
12 swift 0x0000000109761700 swift::irgen::IRGenerator::emitGlobalTopLevel() + 1712
13 swift 0x0000000109891e85 performIRGeneration(swift::IRGenOptions&, swift::ModuleDecl*, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, llvm::StringRef, swift::PrimarySpecificPaths const&, llvm::LLVMContext&, swift::SourceFile*, llvm::GlobalVariable**) + 1189
14 swift 0x000000010967e5aa performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 36682
15 swift 0x0000000109671e54 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 6820
16 swift 0x00000001095ff3c3 main + 1219
17 libdyld.dylib 0x00007fff6e3d2405 start + 1
<unknown>:0: error: unable to execute command: Segmentation fault: 11
<unknown>:0: error: compile command failed due to signal 11 (use -v to see invocation)
The text was updated successfully, but these errors were encountered:
Crashes on master and in Xcode 10.2 as well. @jckarter, @DougGregor, do you remember how this was supposed to work, or what rule was supposed to ban it?
An @objc method in an extension is supposed to avoid trying to reify the erased generic arguments of the ObjC class. It looks like we're generating some code that tries to reify them anyway.
Hi, I’m new in the community and I looked this ticket and i thought that maybe i can help and try to fix it. Can someone give me some directions on where I need too look in the code? Thanks!
bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler in itselfcrashBug: A crash, i.e., an abnormal termination of software
Environment
Apple Swift version 5.1 (swiftlang-1100.0.270.13 clang-1100.0.33.7)
Target: x86_64-apple-darwin19.0.0
Additional Detail from JIRA
md5: da7d5242311cc91d2247bffdb21794bb
relates to:
Issue Description:
If I try to extend a generic Obj-C type from Swift with a new method, I get an error about how generic parameters aren't available at runtime. If I add the
@objc
attribute this error goes away, but instead I get a compiler crash.The text was updated successfully, but these errors were encountered: