Skip to content

Update assertion for partial_apply [on_stack] lifetime ends in lifetime completion #65198

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

Merged
merged 1 commit into from
Apr 15, 2023

Conversation

meg-gupta
Copy link
Contributor

@meg-gupta meg-gupta commented Apr 14, 2023

Since partial_apply [on_stack] is considered as a BorrowingOperand now, and BorrowingOperand::visitScopeEndingUses can be called on its forwarded value's lifetime ends, update the assertion to reflect this.

@meg-gupta
Copy link
Contributor Author

@swift-ci test

@compnerd
Copy link
Member

#65194 has been merge, trying again

@meg-gupta
Copy link
Contributor Author

@swift-ci smoke test and merge

@compnerd
Copy link
Member

@swift-ci please test

@compnerd
Copy link
Member

Assertion failed: pai && pai->isOnStack() || OwnershipForwardingMixin::get(borrowEnd->getUser()), file C:\Users\swift-ci\jenkins\workspace\swift-PR-windows\swift\include\swift/SIL/OwnershipUseVisitor.h, line 299

Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.

Stack dump:

0.	Program arguments: T:\\1\\bin\\swiftc.exe -frontend -c C:\\Users\\swift-ci\\jenkins\\workspace\\swift-PR-windows\\swiftpm\\Sources\\Workspace\\CheckoutState.swift -primary-file C:\\Users\\swift-ci\\jenkins\\workspace\\swift-PR-windows\\swiftpm\\Sources\\Workspace\\DefaultPluginScriptRunner.swift C:\\Users\\swift-ci\\jenkins\\workspace\\swift-PR-windows\\swiftpm\\Sources\\Workspace\\Diagnostics.swift C:\\Users\\swift-ci\\jenkins\\workspace\\swift-PR-windows\\swiftpm\\Sources\\Workspace\\FileSystemPackageContainer.swift C:\\Users\\swift-ci\\jenkins\\workspace\\swift-PR-windows\\swiftpm\\Sources\\Workspace\\InitPackage.swift C:\\Users\\swift-ci\\jenkins\\workspace\\swift-PR-windows\\swiftpm\\Sources\\Workspace\\ManagedArtifact.swift C:\\Users\\swift-ci\\jenkins\\workspace\\swift-PR-windows\\swiftpm\\Sources\\Workspace\\ManagedDependency.swift C:\\Users\\swift-ci\\jenkins\\workspace\\swift-PR-windows\\swiftpm\\Sources\\Workspace\\RegistryPackageContainer.swift C:\\Users\\swift-ci\\jenkins\\workspace\\swift-PR-windows\\swiftpm\\Sources\\Workspace\\ResolvedFileWatcher.swift C:\\Users\\swift-ci\\jenkins\\workspace\\swift-PR-windows\\swiftpm\\Sources\\Workspace\\ResolverPrecomputationProvider.swift C:\\Users\\swift-ci\\jenkins\\workspace\\swift-PR-windows\\swiftpm\\Sources\\Workspace\\SourceControlPackageContainer.swift C:\\Users\\swift-ci\\jenkins\\workspace\\swift-PR-windows\\swiftpm\\Sources\\Workspace\\ToolsVersionSpecificationRewriter.swift C:\\Users\\swift-ci\\jenkins\\workspace\\swift-PR-windows\\swiftpm\\Sources\\Workspace\\Workspace.swift C:\\Users\\swift-ci\\jenkins\\workspace\\swift-PR-windows\\swiftpm\\Sources\\Workspace\\Workspace+BinaryArtifacts.swift C:\\Users\\swift-ci\\jenkins\\workspace\\swift-PR-windows\\swiftpm\\Sources\\Workspace\\Workspace+Configuration.swift C:\\Users\\swift-ci\\jenkins\\workspace\\swift-PR-windows\\swiftpm\\Sources\\Workspace\\Workspace+State.swift -emit-module-path Sources\\Workspace\\CMakeFiles\\Workspace.dir\\DefaultPluginScriptRunner.swift.swiftmodule -emit-module-doc-path Sources\\Workspace\\CMakeFiles\\Workspace.dir\\DefaultPluginScriptRunner.swift.swiftdoc -emit-module-source-info-path Sources\\Workspace\\CMakeFiles\\Workspace.dir\\DefaultPluginScriptRunner.swift.swiftsourceinfo -emit-dependencies-path Sources\\Workspace\\CMakeFiles\\Workspace.dir\\DefaultPluginScriptRunner.swift.obj.d -emit-reference-dependencies-path Sources\\Workspace\\CMakeFiles\\Workspace.dir\\DefaultPluginScriptRunner.swift.obj.swiftdeps -target x86_64-unknown-windows-msvc -disable-objc-interop -I swift -I T:\\7\\swift -I T:\\6\\swift -I C:\\Users\\swift-ci\\jenkins\\workspace\\swift-PR-windows\\swift-system\\Sources\\CSystem\\include -I T:\\4\\swift -I T:\\3\\src\\swift\\swift -I T:\\3 -I C:\\Users\\swift-ci\\jenkins\\workspace\\swift-PR-windows\\swift-corelibs-libdispatch -I C:\\Users\\swift-ci\\jenkins\\workspace\\swift-PR-windows\\swift-corelibs-libdispatch\\src -I T:\\3\\src -I C:\\Users\\swift-ci\\jenkins\\workspace\\swift-PR-windows\\swift-corelibs-libdispatch\\src\\BlocksRuntime -I T:\\13\\swift -I T:\\12\\swift -I C:\\Users\\swift-ci\\jenkins\\workspace\\swift-PR-windows\\swift-crypto\\Sources\\CCryptoBoringSSL\\include -I T:\\15\\swift -I T:\\14\\swift -vfsoverlay T:/2/stdlib/windows-vfs-overlay.yaml -vfsoverlay T:/3/dispatch-vfs-overlay.yaml -autolink-force-load -module-link-name Workspace -swift-version 5 -O -D Workspace_EXPORTS -validate-tbd-against-ir=none -plugin-path T:\\1\\lib\\swift\\host\\plugins -plugin-path T:\\1\\local\\lib\\swift\\host\\plugins -Xcc -D_CRT_SECURE_NO_WARNINGS -Xcc -FT:/4 -autolink-library oldnames -autolink-library msvcrt -Xcc -D_MT -Xcc -D_DLL -parse-as-library -module-name Workspace -o Sources\\Workspace\\CMakeFiles\\Workspace.dir\\DefaultPluginScriptRunner.swift.obj

1.	Swift version 5.9-dev (LLVM d2b0be1f07d15a1, Swift b16947538de8c22)

2.	Compiling with the current language version

3.	While evaluating request ExecuteSILPipelineRequest(Run pipelines { PrepareOptimizationPasses, EarlyModulePasses, HighLevel,Function+EarlyLoopOpt, HighLevel,Module+StackPromote, MidLevel,Function, ClosureSpecialize, LowLevel,Function, LateLoopOpt, SIL Debug Info Generator } on SIL for Workspace)

4.	While running pass #67608 SILFunctionTransform "Mem2Reg" on SILFunction "@$s9Workspace25DefaultPluginScriptRunnerV07compilecD011sourceFiles10pluginName12toolsVersion18observabilityScope13callbackQueue8delegate10completionySay8TSCBasic12AbsolutePathVG_SS12PackageModel05ToolsL0V6Basics013ObservabilityN0C8Dispatch08DispatchP0C12SPMBuildCore0cD16CompilerDelegate_pys6ResultOyAY0C17CompilationResultVs5Error_pGctFyA0_yAL13ProcessResultVsA3__pGcfU3_".

 for expression at [C:\Users\swift-ci\jenkins\workspace\swift-PR-windows\swiftpm\Sources\Workspace\DefaultPluginScriptRunner.swift:347:104 - line:387:9] RangeText="{

            // We are now on our caller's requested callback queue, so we just call the completion handler directly.

            dispatchPrecondition(condition: .onQueue(callbackQueue))

            completion($0.tryMap { process in

                // Emit the compiler output as observable info.

                let compilerOutput = ((try? process.utf8Output()) ?? "") + ((try? process.utf8stderrOutput()) ?? "")

                if !compilerOutput.isEmpty {

                    observabilityScope.emit(info: compilerOutput)

                }



                // Save the persisted compilation state for possible reuse next time.

                let compilationState = PersistedCompilationState(

                    commandLine: commandLine,

                    environment: toolchain.swiftCompilerEnvironment,

                    inputHash: compilerInputHash,

                    output: compilerOutput,

                    result: .init(process.exitStatus))

                do {

                    try JSONEncoder.makeWithDefaults().encode(path: stateFilePath, fileSystem: self.fileSystem, compilationState)

                }

                catch {

                    // We couldn't write out the `.state` file. We warn about it but proceed.

                    observabilityScope.emit(debug: "Couldn't save plugin compilation state (\(error))")

                }



                // Construct a PluginCompilationResult for both the successful and unsuccessful cases (to convey diagnostics, etc).

                let result = PluginCompilationResult(

                    succeeded: compilationState.succeeded,

                    commandLine: commandLine,

                    executableFile: execFilePath,

                    diagnosticsFile: diagFilePath,

                    compilerOutput: compilerOutput,

                    cached: false)



                // Tell the delegate that we're done compiling the plugin, passing it the result.

                delegate.didCompilePlugin(result: result)

                

                // Also return the result to the caller.

                return result

            })

        "

Exception Code: 0x80000003

 #0 0x00007ff7a5400b35 (T:\1\bin\swiftc.exe+0x5600b35)

 #1 0x00007fffd156d88d (C:\Windows\System32\ucrtbase.dll+0x6d88d)

 #2 0x00007fffd156e761 (C:\Windows\System32\ucrtbase.dll+0x6e761)

 #3 0x00007fffd15700c1 (C:\Windows\System32\ucrtbase.dll+0x700c1)

 #4 0x00007fffd15703f1 (C:\Windows\System32\ucrtbase.dll+0x703f1)

 #5 0x00007ff7a0f00fb8 (T:\1\bin\swiftc.exe+0x1100fb8)

 #6 0x00007ff7a0e34fa3 (T:\1\bin\swiftc.exe+0x1034fa3)

 #7 0x00007ff7a0e3504a (T:\1\bin\swiftc.exe+0x103504a)

 #8 0x00007ff7a0e3504a (T:\1\bin\swiftc.exe+0x103504a)

 #9 0x00007ff7a0e33759 (T:\1\bin\swiftc.exe+0x1033759)

#10 0x00007ff7a0edb748 (T:\1\bin\swiftc.exe+0x10db748)

#11 0x00007ff7a0f00dbc (T:\1\bin\swiftc.exe+0x1100dbc)

#12 0x00007ff7a0f0137e (T:\1\bin\swiftc.exe+0x110137e)

#13 0x00007ff7a0f003f3 (T:\1\bin\swiftc.exe+0x11003f3)

#14 0x00007ff7a0efe469 (T:\1\bin\swiftc.exe+0x10fe469)

#15 0x00007ff7a08aeb3d (T:\1\bin\swiftc.exe+0xaaeb3d)

#16 0x00007ff7a08ab5fb (T:\1\bin\swiftc.exe+0xaab5fb)

#17 0x00007ff7a08ae22a (T:\1\bin\swiftc.exe+0xaae22a)

#18 0x00007ff7a08ae65c (T:\1\bin\swiftc.exe+0xaae65c)

#19 0x00007ff7a061a41d (T:\1\bin\swiftc.exe+0x81a41d)

#20 0x00007ff7a06196ed (T:\1\bin\swiftc.exe+0x8196ed)

#21 0x00007ff7a0617e2c (T:\1\bin\swiftc.exe+0x817e2c)

#22 0x00007ff7a06180c5 (T:\1\bin\swiftc.exe+0x8180c5)

#23 0x00007ff7a0617b37 (T:\1\bin\swiftc.exe+0x817b37)

#24 0x00007ff7a05e46fd (T:\1\bin\swiftc.exe+0x7e46fd)

#25 0x00007ff7a06146b1 (T:\1\bin\swiftc.exe+0x8146b1)

#26 0x00007ff7a0618174 (T:\1\bin\swiftc.exe+0x818174)

#27 0x00007ff7a05e4515 (T:\1\bin\swiftc.exe+0x7e4515)

#28 0x00007ff7a00bb281 (T:\1\bin\swiftc.exe+0x2bb281)

#29 0x00007ff79fec8f4d (T:\1\bin\swiftc.exe+0xc8f4d)

#30 0x00007ff79fec9e6e (T:\1\bin\swiftc.exe+0xc9e6e)

#31 0x00007ff79fec8a60 (T:\1\bin\swiftc.exe+0xc8a60)

#32 0x00007ff79fec8c13 (T:\1\bin\swiftc.exe+0xc8c13)

#33 0x00007ff79fecb187 (T:\1\bin\swiftc.exe+0xcb187)

#34 0x00007ff79fe8778c (T:\1\bin\swiftc.exe+0x8778c)

#35 0x00007ff79fe873f9 (T:\1\bin\swiftc.exe+0x873f9)

#36 0x00007ff7a548e284 (T:\1\bin\swiftc.exe+0x568e284)

#37 0x00007fffd4c67974 (C:\Windows\System32\KERNEL32.DLL+0x17974)

#38 0x00007fffd529a2f1 (C:\Windows\SYSTEM32\ntdll.dll+0x5a2f1)

<unknown>:0: error: compile command failed due to signal -2147483645 (use -v to see invocation)

…me completion

Since partial_apply [on_stack] is considered as a BorrowingOperand now,
and BorrowingOperand::visitScopeEndingUses can be called on the its forwarded values
lifetime ends, update the assertion to reflect this.
@meg-gupta
Copy link
Contributor Author

@swift-ci test

@meg-gupta
Copy link
Contributor Author

@swift-ci test

@compnerd
Copy link
Member

@swift-ci please build toolchain Windows platform

@ahoppen ahoppen merged commit 65adfd9 into swiftlang:main Apr 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants