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-7407] Unowned reference to a protocol composition type with NSObject causes crash #49950

Closed
swift-ci opened this issue Apr 11, 2018 · 0 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-7407
Radar None
Original Reporter skagedal (JIRA User)
Type Bug
Status Resolved
Resolution Duplicate

Attachment: Download

Environment

Xcode 9.3

Additional Detail from JIRA
Votes 0
Component/s
Labels Bug
Assignee None
Priority Medium

md5: c091ef63684fad515acc588ebc597317

duplicates:

  • SR-7369 Invalid InsertValueInst operands

Issue Description:

This code crashes the compiler:

import Foundation

protocol SomeProtocol { }

class OtherClass {
    unowned var obj: NSObject & SomeProtocol
    
    init(obj: NSObject & SomeProtocol) {
        self.obj = obj
    }
}

Output from compiler:

swift-crash swift build
Compile Swift Module 'swift_crash' (1 sources)
Invalid InsertValueInst operands!
  %12 = insertvalue { %TSo8NSObjectC*, i8** } undef, %objc_object* %8, 0, !dbg !64
<unknown>:0: error: fatal error encountered during compilation; please file a bug report with your project and the crash log
<unknown>:0: note: Broken function found, compilation aborted!
0  swift                    0x000000010945fffa PrintStackTraceSignalHandler(void*) + 42
1  swift                    0x000000010945f3b6 SignalHandler(int) + 966
2  libsystem_platform.dylib 0x00007fff65557f5a _sigtramp + 26
3  libsystem_platform.dylib 0x00007ffeea1be130 _sigtramp + 2227593712
4  libsystem_c.dylib        0x00007fff652f51ae abort + 127
5  swift                    0x0000000105ab68e7 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*)::$_0::__invoke(void*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, bool) + 519
6  swift                    0x0000000109417658 llvm::report_fatal_error(llvm::Twine const&, bool) + 280
7  swift                    0x0000000109417539 llvm::report_fatal_error(char const*, bool) + 41
8  swift                    0x00000001093dfca6 (anonymous namespace)::VerifierLegacyPass::runOnFunction(llvm::Function&) + 54
9  swift                    0x00000001093877d1 llvm::FPPassManager::runOnFunction(llvm::Function&) + 449
10 swift                    0x000000010938f703 llvm::legacy::FunctionPassManagerImpl::run(llvm::Function&) + 115
11 swift                    0x000000010938f5fc llvm::legacy::FunctionPassManager::run(llvm::Function&) + 396
12 swift                    0x0000000105c5fa18 swift::performLLVM(swift::IRGenOptions&, swift::DiagnosticEngine*, llvm::sys::SmartMutex<false>*, llvm::GlobalVariable*, llvm::Module*, llvm::TargetMachine*, swift::version::Version const&, llvm::StringRef, swift::UnifiedStatsReporter*) + 5096
13 swift                    0x0000000105ac177d performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 44685
14 swift                    0x0000000105ab4e64 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 7908
15 swift                    0x0000000105a698b5 main + 18917
16 libdyld.dylib            0x00007fff65249015 start + 1
Stack dump:
0.  Program arguments: /Applications/Xcode-9.3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file /Users/simon/Desktop/swift-crash/Sources/swift-crash/main.swift -target x86_64-apple-macosx10.10 -enable-objc-interop -sdk /Applications/Xcode-9.3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk -I /Users/simon/Desktop/swift-crash/.build/x86_64-apple-macosx10.10/debug -F /Applications/Xcode-9.3.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -enable-testing -g -module-cache-path /Users/simon/Desktop/swift-crash/.build/x86_64-apple-macosx10.10/debug/ModuleCache -swift-version 4 -Onone -D SWIFT_PACKAGE -color-diagnostics -emit-module-doc-path /Users/simon/Desktop/swift-crash/.build/x86_64-apple-macosx10.10/debug/swift_crash.build/main~partial.swiftdoc -module-name swift_crash -emit-module-path /Users/simon/Desktop/swift-crash/.build/x86_64-apple-macosx10.10/debug/swift_crash.build/main~partial.swiftmodule -emit-dependencies-path /Users/simon/Desktop/swift-crash/.build/x86_64-apple-macosx10.10/debug/swift_crash.build/main.d -emit-reference-dependencies-path /Users/simon/Desktop/swift-crash/.build/x86_64-apple-macosx10.10/debug/swift_crash.build/main.swiftdeps -num-threads 8 -o /Users/simon/Desktop/swift-crash/.build/x86_64-apple-macosx10.10/debug/swift_crash.build/main.swift.o 
1.  Running pass 'Module Verifier' on function '@_T011swift_crash10OtherClassC3objAA12SomeProtocol_So8NSObjectCXcXovg'
<unknown>:0: error: unable to execute command: Abort trap: 6
<unknown>:0: error: compile command failed due to signal 6 (use -v to see invocation)
error: terminated(1): /Applications/Xcode-9.3.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-build-tool -f /Users/simon/Desktop/swift-crash/.build/debug.yaml main output:
    
@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 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.
Projects
None yet
Development

No branches or pull requests

1 participant