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
swift-ci opened this issue
Dec 23, 2016
· 6 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
SR-892 Closure type inference does not work with inout arguments
SR-1811 Swift 3 regression related to inout closure params and protocols
relates to:
SR-3520 Generic function taking closure with inout parameter can result in a variety of compiler errors or EXC_BAD_ACCESS
Issue Description:
The following gives a segmentation fault in swiftc:
func f() {
let _ = unfold((0, 0)) { s in 0 }
}
func unfold<A, B>(_ a0: A, next: (inout A)->B) {}
It compiles when I write an explicit type for the closure or if I pass 0 instead of (0,0) for a0. Now, if I change unfold to use a single type parameter:
func f() {
let _ = unfold((0,0)) { s in 0 } // incompatible types
}
func unfold<A>(_ a0: A, next: (inout A)->A) {}
instead of giving a type error swiftc just prints
<unknown>:0: error: parameters may not have the 'var' specifier
If I change the closure to return (0,0) instead of 0, it segfaults again.
0 swift 0x0000000105f6b3ad PrintStackTraceSignalHandler(void*) + 45
1 swift 0x0000000105f6ab56 SignalHandler(int) + 790
2 libsystem_platform.dylib 0x00007fff8783e52a _sigtramp + 26
3 libsystem_platform.dylib 0x0000000106dda000 _sigtramp + 2136586992
4 swift 0x00000001031e4250 (anonymous namespace)::TranslateArguments::translate(swift::Lowering::AbstractionPattern, swift::CanType, swift::Lowering::AbstractionPattern, swift::CanType) + 1472
5 swift 0x00000001031e3028 createThunk(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::ManagedValue, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::AnyFunctionType>, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::AnyFunctionType>, swift::Lowering::TypeLowering const&) + 1784
6 swift 0x00000001031e0515 (anonymous namespace)::Transform::transform(swift::Lowering::ManagedValue, swift::Lowering::AbstractionPattern, swift::CanType, swift::Lowering::AbstractionPattern, swift::CanType, swift::Lowering::SGFContext) + 1909
7 swift 0x00000001031a5c19 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 58313
8 swift 0x000000010314c264 (anonymous namespace)::ArgEmitter::emit(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 1332
9 swift 0x000000010314e557 (anonymous namespace)::ArgEmitter::emitExpanded(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 263
10 swift 0x000000010314be29 (anonymous namespace)::ArgEmitter::emit(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 249
11 swift 0x0000000103150d1d (anonymous namespace)::ArgEmitter::emitShuffle(swift::Expr*, swift::Expr*, llvm::ArrayRef<swift::TupleTypeElt>, swift::ConcreteDeclRef, llvm::ArrayRef<swift::Expr*>, llvm::ArrayRef<int>, llvm::ArrayRef<unsigned int>, swift::Type, swift::Lowering::AbstractionPattern) + 3885
12 swift 0x000000010314eca3 (anonymous namespace)::ArgEmitter::emitExpanded(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 2131
13 swift 0x000000010314be29 (anonymous namespace)::ArgEmitter::emit(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern) + 249
14 swift 0x000000010314b407 (anonymous namespace)::CallSite::emit(swift::Lowering::SILGenFunction&, swift::Lowering::AbstractionPattern, (anonymous namespace)::ParamLowering&, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, llvm::SmallVectorImpl<std::__1::pair<swift::Lowering::LValue, swift::SILLocation> >&, llvm::Optional<swift::ForeignErrorConvention> const&, swift::ImportAsMemberStatus const&) && + 519
15 swift 0x000000010314809b (anonymous namespace)::CallEmission::apply(swift::Lowering::SGFContext) + 5339
16 swift 0x00000001031978c5 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 117
17 swift 0x00000001031976e3 swift::Lowering::SILGenFunction::emitExprInto(swift::Expr*, swift::Lowering::Initialization*) + 195
18 swift 0x0000000103184dd3 swift::Lowering::SILGenFunction::emitPatternBinding(swift::PatternBindingDecl*, unsigned int) + 195
19 swift 0x000000010313c09d swift::ASTVisitor<swift::Lowering::SILGenFunction, void, void, void, void, void, void>::visit(swift::Decl*) + 125
20 swift 0x00000001031f5769 swift::ASTVisitor<(anonymous namespace)::StmtEmitter, void, void, void, void, void, void>::visit(swift::Stmt*) + 4169
21 swift 0x00000001031b5e1a swift::Lowering::SILGenFunction::emitFunction(swift::FuncDecl*) + 314
22 swift 0x0000000103132055 swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*)::$_1::operator()(swift::SILFunction*) const + 1877
23 swift 0x0000000103130c02 swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*) + 626
24 swift 0x000000010313db03 swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*, unsigned int) + 2195
25 swift 0x000000010313f62d swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*, llvm::Optional<unsigned int>, bool, bool) + 1629
26 swift 0x0000000102f77e86 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*) + 19510
27 swift 0x0000000102f712b3 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 17859
28 swift 0x0000000102f2d5cf main + 8239
29 libdyld.dylib 0x00007fff892545ad 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-macosx10.9 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk -color-diagnostics -module-name crash -o /var/folders/.../crash-9f8735.o
1. While emitting SIL for 'f' at crash.swift:1:1
2. While emitting reabstraction thunk in SIL function @_TTRXFo_dSidSi_dSidSi_XFo_lTSiSi__dSidSi_<unknown>:0: error: unable to execute command: Segmentation fault: 11
The text was updated successfully, but these errors were encountered:
Unhandled conversion to exploded tuple
UNREACHABLE executed at /Volumes/Data/swift-public/swift/lib/SILGen/SILGenPoly.cpp:962!
1. While emitting SIL for 'f' at <stdin>:1:1
2. While emitting reabstraction thunk in SIL function @_TTRXFo_dSidSi_dSi_XFo_lTSiSi__dSi_
@slavapestov, you've been looking at things like this...
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
swiftc 3.0.2
Additional Detail from JIRA
md5: 9ecb7420a0cb4bea9dccbd3411386b03
is duplicated by:
relates to:
Issue Description:
The following gives a segmentation fault in swiftc:
It compiles when I write an explicit type for the closure or if I pass 0 instead of (0,0) for a0. Now, if I change unfold to use a single type parameter:
instead of giving a type error swiftc just prints
If I change the closure to return (0,0) instead of 0, it segfaults again.
The text was updated successfully, but these errors were encountered: