Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-2320] swiftc segfaults on invalid method call on AnyObject #44927

Closed
swift-ci opened this issue Aug 11, 2016 · 2 comments
Closed

[SR-2320] swiftc segfaults on invalid method call on AnyObject #44927

swift-ci opened this issue Aug 11, 2016 · 2 comments
Assignees
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software SILGen Area → compiler: The SIL generation stage

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-2320
Radar None
Original Reporter der_fab (JIRA User)
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, CompilerCrash, SILGen
Assignee @slavapestov
Priority Medium

md5: 6dccaf55cdc99277fa7b6b8907e0ad6c

Issue Description:

The following code crashes swiftc when called with xcrun -sdk macosx swiftc Crash.swift

Crash.swift:

import Foundation

extension NSDictionary {
   func blub() throws {}
}

func test(a : AnyObject)
{
   try! a.blub()
}

Details:

> xcrun -sdk macosx swiftc Crash.swift 
0  swift                    0x0000000106ab866b llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 43
1  swift                    0x0000000106ab7956 llvm::sys::RunSignalHandlers() + 70
2  swift                    0x0000000106ab8ccf SignalHandler(int) + 287
3  libsystem_platform.dylib 0x00007fff8bd2652a _sigtramp + 26
4  libsystem_platform.dylib 000000000000000000 _sigtramp + 1949145840
5  swift                    0x00000001048ac03a swift::irgen::CallEmission::setArgs(swift::irgen::Explosion&, llvm::ArrayRef<swift::SILParameterInfo>, swift::irgen::WitnessMetadata*) + 3034
6  swift                    0x0000000104953a60 (anonymous namespace)::IRGenSILFunction::visitFullApplySite(swift::FullApplySite) + 2736
7  swift                    0x000000010494123b swift::irgen::IRGenModule::emitSILFunction(swift::SILFunction*) + 9787
8  swift                    0x000000010489c5c8 swift::irgen::IRGenModuleDispatcher::emitGlobalTopLevel() + 600
9  swift                    0x000000010492804e performIRGeneration(swift::IRGenOptions&, swift::ModuleDecl*, swift::SILModule*, llvm::StringRef, llvm::LLVMContext&, swift::SourceFile*, unsigned int) + 1278
10 swift                    0x00000001049284f6 swift::performIRGeneration(swift::IRGenOptions&, swift::SourceFile&, swift::SILModule*, llvm::StringRef, llvm::LLVMContext&, unsigned int) + 70
11 swift                    0x000000010480bc8c performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&) + 15004
12 swift                    0x000000010480768d frontend_main(llvm::ArrayRef<char const*>, char const*, void*) + 2781
13 swift                    0x00000001048030ac main + 1932
14 libdyld.dylib            0x00007fff8f72d5ad start + 1
15 libdyld.dylib            0x000000000000000f start + 1888299619
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.11.sdk -color-diagnostics -module-name Crash -o /var/folders/y7/xcc17mnj6892fdqb4l7c0s6xrznjh4/T/Crash-d33749.o 
1.  While emitting IR SIL function @_TF5Crash4testFPs9AnyObject_T_ for 'test' at Crash.swift:7: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)

> swiftc --version
Apple Swift version 2.2 (swiftlang-703.0.18.8 clang-703.0.31)
Target: x86_64-apple-macosx10.9
/projects/swiftc_bug (JIRA User)

XCode Version:
Version 7.3.1 (7D1014)

@belkadan
Copy link
Contributor

Still crashing:

Assertion failed: (Params.empty() && "didn't consume all the parameters"), function ~ParamLowering, file /Volumes/Data/swift-public/swift/lib/SILGen/SILGenApply.cpp, line 3967.
7  swift                    0x000000010436ad10 (anonymous namespace)::CallEmission::apply(swift::Lowering::SGFContext) + 10848
8  swift                    0x0000000104367db3 swift::Lowering::SILGenFunction::emitApplyExpr(swift::Expr*, swift::Lowering::SGFContext) + 51
9  swift                    0x00000001043afd45 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 85

@slavapestov
Copy link
Member

#6543

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@AnthonyLatsis AnthonyLatsis added the crash Bug: A crash, i.e., an abnormal termination of software label Dec 12, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software SILGen Area → compiler: The SIL generation stage
Projects
None yet
Development

No branches or pull requests

4 participants