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-8269] PHI node operands are not the same type as the result #50800
Comments
@swift-ci create |
Comment by Benedikt Terhechte (JIRA) When I use a current developer snapshot from swift.org, there's more information. I feel like the problem might be that the "annotated" version of "document_create" (Document.init) returns type Document while the original C FFI version returned UnsafeMutablePointer<Document>? SIL verification failed: branch argument types do not match arguments for dest bb: std::equal(BI->getArgs().begin(), BI->getArgs().end(), BI->getDestBB()->args_begin(), [&](SILValue branchArg, SILArgument *bbArg) { return verifyBranchArgs(branchArg, bbArg); }) // %8 // user: %9 bb2: // Preds: bb0 // %13 // user: %15 bb4: // Preds: bb3 // %30 // user: %31 bb6: // Preds: bb5 bb4 bb7: // Preds: bb3 // %48 // user: %49 bb9: // Preds: bb8 bb7 bb10(%62 : $Optional<()>): // Preds: bb11 bb9 bb11: // Preds: bb6 0 swift 0x00000001068766e8 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40 |
Oh, that's definitely possible, yeah. Initializers should always return the actual type directly. I guess the compiler should check for this, but it's not critical, then. |
Comment by Brian (JIRA) We started running into this exception intermittently on our archive builds. It occurs on Xcode 12.5.1 and Xcode 13 beta 5. It started when we introduced `some OurProtocol`, instead of returning concrete types. It only started happening about a month after we started using `some`, and it occurs with only one of our types. It appears that if the type is generic, it's fine - even just adding an un-used generic parameter fixes the issue currently. If the code is moved into a different module, the issue goes away (The module it is in also defines the protocol, which may be the differentiator). Unfortunately it will be a bit challenging to create a reproducible project. {{ PHI node operands are not the same type as the result! |
Attachment: Download
Environment
Xcode Version 10.0 beta (10L176w)
Additional Detail from JIRA
md5: 3b11412813a2be54892e098535011810
relates to:
Issue Description:
I'm getting a trap 6 error with a message saying "error: fatal error encountered during compilation; please file a bug report with your project and the crash log".
The project is attached. The bug happens in a project that uses FFI to communicate with a library that was written in Rust. I was playing around with "attribute((swift_name(...)));" so I suppose this is where the error happened.
An example project is attached.
Here's the output:
PHI node operands are not the same type as the result!
%20 = phi i1 [ true, %18 ], [ %17, %15 ], 201
:0: error: fatal error encountered during compilation; please file a bug report with your project and the crash log
:0: note: Broken function found, compilation aborted!
0 swift 0x0000000113c2ec5a PrintStackTraceSignalHandler(void*) + 42
1 swift 0x0000000113c2e066 SignalHandler(int) + 966
2 libsystem_platform.dylib 0x00007fff6278ff5a _sigtramp + 26
3 libsystem_platform.dylib 000000000000000000 _sigtramp + 2642870464
4 libsystem_c.dylib 0x00007fff6252d1ae abort + 127
5 swift 0x000000010ff00e39 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*)::$_1::__invoke(void*, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, bool) + 521
6 swift 0x0000000113be1ec8 llvm::report_fatal_error(llvm::Twine const&, bool) + 280
7 swift 0x0000000113be1dab llvm::report_fatal_error(char const*, bool) + 43
8 swift 0x0000000113ba9c56 (anonymous namespace)::VerifierLegacyPass::runOnFunction(llvm::Function&) + 54
9 swift 0x0000000113b5092e llvm::FPPassManager::runOnFunction(llvm::Function&) + 446
10 swift 0x0000000113b58c63 llvm::legacy::FunctionPassManagerImpl::run(llvm::Function&) + 115
11 swift 0x0000000113b58b5c llvm::legacy::FunctionPassManager::run(llvm::Function&) + 396
12 swift 0x00000001100bca68 swift::performLLVM(swift::IRGenOptions&, swift::DiagnosticEngine*, llvm::sys::SmartMutex, llvm::GlobalVariable, llvm::Module*, llvm::TargetMachine*, swift::version::Version const&, llvm::StringRef, swift::UnifiedStatsReporter*) + 5208
13 swift 0x000000010ff0d5c5 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 49093
14 swift 0x000000010fefe10f swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 7839
15 swift 0x000000010fea7c48 main + 13144
16 libdyld.dylib 0x00007fff62481015 start + 1
17 libdyld.dylib 0x0000000000000049 start + 2646077493
Stack dump:
0. Program arguments: /Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file /Users/terhechte/Desktop/ExplodeExample/ExplodeExample/AppDelegate.swift -emit-module-path /Users/terhechte/Library/Developer/Xcode/DerivedData/ExplodeExample-gwroxgvbjxfwoifdtvhsujvisztr/Build/Intermediates.noindex/ExplodeExample.build/Debug/ExplodeExample.build/Objects-normal/x86_64/AppDelegate
partial.swiftmodule -emit-module-doc-path /Users/terhechte/Library/Developer/Xcode/DerivedData/ExplodeExample-gwroxgvbjxfwoifdtvhsujvisztr/Build/Intermediates.noindex/ExplodeExample.build/Debug/ExplodeExample.build/Objects-normal/x86_64/AppDelegatepartial.swiftdoc -serialize-diagnostics-path /Users/terhechte/Library/Developer/Xcode/DerivedData/ExplodeExample-gwroxgvbjxfwoifdtvhsujvisztr/Build/Intermediates.noindex/ExplodeExample.build/Debug/ExplodeExample.build/Objects-normal/x86_64/AppDelegate.dia -emit-dependencies-path /Users/terhechte/Library/Developer/Xcode/DerivedData/ExplodeExample-gwroxgvbjxfwoifdtvhsujvisztr/Build/Intermediates.noindex/ExplodeExample.build/Debug/ExplodeExample.build/Objects-normal/x86_64/AppDelegate.d -emit-reference-dependencies-path /Users/terhechte/Library/Developer/Xcode/DerivedData/ExplodeExample-gwroxgvbjxfwoifdtvhsujvisztr/Build/Intermediates.noindex/ExplodeExample.build/Debug/ExplodeExample.build/Objects-normal/x86_64/AppDelegate.swiftdeps -target x86_64-apple-macosx10.13 -enable-objc-interop -sdk /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -I /Users/terhechte/Library/Developer/Xcode/DerivedData/ExplodeExample-gwroxgvbjxfwoifdtvhsujvisztr/Build/Products/Debug -F /Users/terhechte/Library/Developer/Xcode/DerivedData/ExplodeExample-gwroxgvbjxfwoifdtvhsujvisztr/Build/Products/Debug -enable-testing -g -module-cache-path /Users/terhechte/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -swift-version 4.2 -enforce-exclusivity=checked -Onone -D DEBUG -serialize-debugging-options -Xcc -working-directory -Xcc /Users/terhechte/Desktop/ExplodeExample -Xcc -I/Users/terhechte/Library/Developer/Xcode/DerivedData/ExplodeExample-gwroxgvbjxfwoifdtvhsujvisztr/Build/Intermediates.noindex/ExplodeExample.build/Debug/ExplodeExample.build/swift-overrides.hmap -Xcc -iquote -Xcc /Users/terhechte/Library/Developer/Xcode/DerivedData/ExplodeExample-gwroxgvbjxfwoifdtvhsujvisztr/Build/Intermediates.noindex/ExplodeExample.build/Debug/ExplodeExample.build/ExplodeExample-generated-files.hmap -Xcc -I/Users/terhechte/Library/Developer/Xcode/DerivedData/ExplodeExample-gwroxgvbjxfwoifdtvhsujvisztr/Build/Intermediates.noindex/ExplodeExample.build/Debug/ExplodeExample.build/ExplodeExample-own-target-headers.hmap -Xcc -I/Users/terhechte/Library/Developer/Xcode/DerivedData/ExplodeExample-gwroxgvbjxfwoifdtvhsujvisztr/Build/Intermediates.noindex/ExplodeExample.build/Debug/ExplodeExample.build/ExplodeExample-all-target-headers.hmap -Xcc -iquote -Xcc /Users/terhechte/Library/Developer/Xcode/DerivedData/ExplodeExample-gwroxgvbjxfwoifdtvhsujvisztr/Build/Intermediates.noindex/ExplodeExample.build/Debug/ExplodeExample.build/ExplodeExample-project-headers.hmap -Xcc -I/Users/terhechte/Library/Developer/Xcode/DerivedData/ExplodeExample-gwroxgvbjxfwoifdtvhsujvisztr/Build/Products/Debug/include -Xcc -I/Users/terhechte/Library/Developer/Xcode/DerivedData/ExplodeExample-gwroxgvbjxfwoifdtvhsujvisztr/Build/Intermediates.noindex/ExplodeExample.build/Debug/ExplodeExample.build/DerivedSources/x86_64 -Xcc -I/Users/terhechte/Library/Developer/Xcode/DerivedData/ExplodeExample-gwroxgvbjxfwoifdtvhsujvisztr/Build/Intermediates.noindex/ExplodeExample.build/Debug/ExplodeExample.build/DerivedSources -Xcc -DDEBUG=1 -import-objc-header /Users/terhechte/Desktop/ExplodeExample/Rust/Rust-Bridging-Header.h -pch-output-dir /Users/terhechte/Library/Developer/Xcode/DerivedData/ExplodeExample-gwroxgvbjxfwoifdtvhsujvisztr/Build/Intermediates.noindex/PrecompiledHeaders -parse-as-library -module-name ExplodeExample -o /Users/terhechte/Library/Developer/Xcode/DerivedData/ExplodeExample-gwroxgvbjxfwoifdtvhsujvisztr/Build/Intermediates.noindex/ExplodeExample.build/Debug/ExplodeExample.build/Objects-normal/x86_64/AppDelegate.o -index-store-path /Users/terhechte/Library/Developer/Xcode/DerivedData/ExplodeExample-gwroxgvbjxfwoifdtvhsujvisztr/Index/DataStore -index-system-moduleserror: Abort trap: 6
The text was updated successfully, but these errors were encountered: