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
Feb 24, 2017
· 2 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 softwareSILGenArea → compiler: The SIL generation stage
swift version:
Apple Swift version 3.1 (swiftlang-802.0.36.2 clang-802.0.35)
Target: x86_64-apple-macosx10.9
Additional Detail from JIRA
Votes
0
Component/s
Compiler
Labels
Bug, CompilerCrash, SILGen
Assignee
None
Priority
Medium
md5: 6fbdac0e11237695e145dea45bd8e6e7
duplicates:
SR-1076 SILGen crash on overloading functions which take varargs & arrays
relates to:
SR-3734 Mangling variadicity of function parameters
Issue Description:
The following code will crash the swift compiler (and REPL):
funcfoo(foo: [Int], bar: Int) {
}
funcfoo(foo: Int..., bar: Int) {
}
This issue appears if the first argument of the first function is an array of any type and the first argument of the second function is a variadic argument of the same type.
The second argument is required on both methods for the issue to appear and the type of the second argument must be the same on both methods, but it does not need to match the type of the first argument.
Initializers of structs and classes are also affected.
The swift compiler produces the following output when called with the -v flag:
Apple Swift version 3.1 (swiftlang-802.0.36.2 clang-802.0.35)
Target: x86_64-apple-macosx10.9
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file bug.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 bug -o /var/folders/_z/r4w3qsxd51z_2r9ww94k5z6w0000gn/T/bug-ee7056.o
0 swift 0x00000001117527a7 PrintStackTraceSignalHandler(void*) + 39
1 swift 0x0000000111751d36 SignalHandler(int) + 662
2 libsystem_platform.dylib 0x00007fff96627bba _sigtramp + 26
3 libsystem_platform.dylib 000000000000000000 _sigtramp + 1771930720
4 swift 0x000000010f0a6287 swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*)::$_1::operator()(swift::SILFunction*) const + 1191
5 swift 0x000000010f0a5102 swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*) + 642
6 swift 0x000000010f0b3a81 swift::ASTVisitor<swift::Lowering::SILGenModule, void, void, void, void, void, void>::visit(swift::Decl*) + 657
7 swift 0x000000010f0b2b3b swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*, unsigned int) + 1483
8 swift 0x000000010f0b4719 swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*, llvm::Optional<unsigned int>, bool, bool) + 1593
9 swift 0x000000010e9d93f2 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 45842
10 swift 0x000000010e9893c2 main + 11298
11 libdyld.dylib 0x00007fff9641a255 start + 1
Stack dump:
0. Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file bug.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 bug -o /var/folders/_z/r4w3qsxd51z_2r9ww94k5z6w0000gn/T/bug-ee7056.o
1. While emitting SIL for 'foo' at bug.swift:3:1
<unknown>:0: error: unable to execute command: Segmentation fault: 11
<unknown>:0: error: compile command failed due to signal (use -v to see invocation)
The text was updated successfully, but these errors were encountered:
I think proper fix requires solving SR-3734 first. As a temporary workaround we could maybe add "invalid redeclaration" style warning, so at least it doesn't crash.
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 softwareSILGenArea → compiler: The SIL generation stage
Environment
swift version:
Apple Swift version 3.1 (swiftlang-802.0.36.2 clang-802.0.35)
Target: x86_64-apple-macosx10.9
Additional Detail from JIRA
md5: 6fbdac0e11237695e145dea45bd8e6e7
duplicates:
relates to:
Issue Description:
The following code will crash the swift compiler (and REPL):
This issue appears if the first argument of the first function is an array of any type and the first argument of the second function is a variadic argument of the same type.
The second argument is required on both methods for the issue to appear and the type of the second argument must be the same on both methods, but it does not need to match the type of the first argument.
Initializers of structs and classes are also affected.
The swift compiler produces the following output when called with the -v flag:
The text was updated successfully, but these errors were encountered: