Open stephencelis opened 4 months ago
The remainder of the log is critical. It was a SIL verification failure indicating a bug in SILSen.
@compnerd I believe the log is all captured above, but here's the full link (it may expire in the future): https://github.com/pointfreeco/swift-case-paths/actions/runs/9357788886/job/25758324959?pr=159
I was able to reproduce this on macOS with the latest 5.10 release and the 5.9.2 release.
So this doesn't seem Windows-specific and @stephencelis you should be able to reproduce and reduce by using the above releases.
CC @compnerd
5.10
git clone https://github.com/pointfreeco/swift-case-paths -b case-path-iteration
cd swift-case-paths
~/Library/Developer/Toolchains/swift-5.10-RELEASE.xctoolchain/usr/bin/swift test
...
public class KeyPath<Root, Value> : PartialKeyPath<Root> {
^
indirect result type mismatch!
argument: %0 = argument of bb0 : $*@_opaqueReturnTypeOf("$s26swift_case_paths_benchmark3FooO12AllCasePathsV12makeIteratorQryF", 0) __ // user: %23
expected: $*IndexingIterator<Array<PartialKeyPath<Case<Foo>>>>
SIL verification failed: entry point argument types do not match function type: matched
In function:
// Foo.AllCasePaths.makeIterator()
sil [ossa] @$s26swift_case_paths_benchmark3FooO12AllCasePathsV12makeIteratorQryF : $@convention(method) (Foo.AllCasePaths) -> @out @_opaqueReturnTypeOf("$s26swift_case_paths_benchmark3FooO12AllCasePathsV12makeIteratorQryF", 0) __ {
// %0 "$return_value" // user: %23
// %1 "self" // user: %2
bb0(%0 : $*@_opaqueReturnTypeOf("$s26swift_case_paths_benchmark3FooO12AllCasePathsV12makeIteratorQryF", 0) __, %1 : $Foo.AllCasePaths):
debug_value %1 : $Foo.AllCasePaths, let, name "self", argno 1, implicit // id: %2
%3 = alloc_box ${ var Array<PartialKeyPath<Case<Foo>>> }, var, name "allCasePaths" // users: %33, %4
%4 = begin_borrow [var_decl] %3 : ${ var Array<PartialKeyPath<Case<Foo>>> } // users: %32, %5
%5 = project_box %4 : ${ var Array<PartialKeyPath<Case<Foo>>> }, 0 // users: %24, %18, %12
%6 = integer_literal $Builtin.Word, 0 // user: %8
// function_ref _allocateUninitializedArray<A>(_:)
%7 = function_ref @$ss27_allocateUninitializedArrayySayxG_BptBwlF : $@convention(thin) <τ_0_0> (Builtin.Word) -> (@owned Array<τ_0_0>, Builtin.RawPointer) // user: %8
%8 = apply %7<PartialKeyPath<Case<Foo>>>(%6) : $@convention(thin) <τ_0_0> (Builtin.Word) -> (@owned Array<τ_0_0>, Builtin.RawPointer) // user: %9
(%9, %10) = destructure_tuple %8 : $(Array<PartialKeyPath<Case<Foo>>>, Builtin.RawPointer) // users: %12, %11
%11 = pointer_to_address %10 : $Builtin.RawPointer to [strict] $*PartialKeyPath<Case<Foo>>
store %9 to [init] %5 : $*Array<PartialKeyPath<Case<Foo>>> // id: %12
%13 = keypath $KeyPath<Foo.AllCasePaths, AnyCasePath<Foo, Foo2>>, (root $Foo.AllCasePaths; gettable_property $AnyCasePath<Foo, Foo2>, id @$s26swift_case_paths_benchmark3FooO12AllCasePathsV3foo0gH003AnyG4PathVyAcA4Foo2OGvg : $@convention(method) (Foo.AllCasePaths) -> @owned AnyCasePath<Foo, Foo2>, getter @$s26swift_case_paths_benchmark3FooO12AllCasePathsV3foo0gH003AnyG4PathVyAcA4Foo2OGvpAETK : $@convention(thin) (@in_guaranteed Foo.AllCasePaths) -> @out AnyCasePath<Foo, Foo2>) // user: %14
%14 = keypath $KeyPath<Case<Foo>, Case<Foo2>>, (root $Case<Foo>; gettable_property $Case<Foo2>, id @$s9CasePaths0A0V13dynamicMemberACyqd__Gs7KeyPathCy03AllaB0QzAA03AnyaF0Vyxqd__GG_tcAA0A8PathableRzluig : $@convention(method) <τ_0_0 where τ_0_0 : CasePathable><τ_1_0> (@guaranteed KeyPath<τ_0_0.AllCasePaths, AnyCasePath<τ_0_0, τ_1_0>>, @guaranteed Case<τ_0_0>) -> @owned Case<τ_1_0>, getter @$s9CasePaths0A0V13dynamicMemberACyqd__Gs7KeyPathCy03AllaB0QzAA03AnyaF0Vyxqd__GG_tcAA0A8PathableRzluipACy26swift_case_paths_benchmark3FooOGAqO4Foo2OTK : $@convention(thin) (@in_guaranteed Case<Foo>, UnsafeRawPointer) -> @out Case<Foo2>, indices [%$0 : $KeyPath<Foo.AllCasePaths, AnyCasePath<Foo, Foo2>> : $KeyPath<Foo.AllCasePaths, AnyCasePath<Foo, Foo2>>], indices_equals @$ss7KeyPathCy26swift_case_paths_benchmark3FooO12AllCasePathsV0iJ003AnyiB0VyAeC4Foo2OGGTH : $@convention(thin) (UnsafeRawPointer, UnsafeRawPointer) -> Bool, indices_hash @$ss7KeyPathCy26swift_case_paths_benchmark3FooO12AllCasePathsV0iJ003AnyiB0VyAeC4Foo2OGGTh : $@convention(thin) (UnsafeRawPointer) -> Int, external #Case.subscript<Foo, Foo2>) (%13) // user: %15
%15 = upcast %14 : $KeyPath<Case<Foo>, Case<Foo2>> to $PartialKeyPath<Case<Foo>> // user: %17
%16 = alloc_stack $PartialKeyPath<Case<Foo>> // users: %22, %20, %17
store %15 to [init] %16 : $*PartialKeyPath<Case<Foo>> // id: %17
%18 = begin_access [modify] [unknown] %5 : $*Array<PartialKeyPath<Case<Foo>>> // users: %21, %20
// function_ref Array.append(_:)
%19 = function_ref @$sSa6appendyyxnF : $@convention(method) <τ_0_0> (@in τ_0_0, @inout Array<τ_0_0>) -> () // user: %20
%20 = apply %19<PartialKeyPath<Case<Foo>>>(%16, %18) : $@convention(method) <τ_0_0> (@in τ_0_0, @inout Array<τ_0_0>) -> ()
end_access %18 : $*Array<PartialKeyPath<Case<Foo>>> // id: %21
dealloc_stack %16 : $*PartialKeyPath<Case<Foo>> // id: %22
%23 = unchecked_addr_cast %0 : $*@_opaqueReturnTypeOf("$s26swift_case_paths_benchmark3FooO12AllCasePathsV12makeIteratorQryF", 0) __ to $*IndexingIterator<Array<PartialKeyPath<Case<Foo>>>> // user: %30
%24 = begin_access [read] [unknown] %5 : $*Array<PartialKeyPath<Case<Foo>>> // users: %26, %25
%25 = load [copy] %24 : $*Array<PartialKeyPath<Case<Foo>>> // user: %28
end_access %24 : $*Array<PartialKeyPath<Case<Foo>>> // id: %26
%27 = alloc_stack $Array<PartialKeyPath<Case<Foo>>> // users: %31, %30, %28
store %25 to [init] %27 : $*Array<PartialKeyPath<Case<Foo>>> // id: %28
// function_ref Collection<>.makeIterator()
%29 = function_ref @$sSlss16IndexingIteratorVyxG0B0RtzrlE04makeB0ACyF : $@convention(method) <τ_0_0 where τ_0_0 : Collection, τ_0_0.Iterator == IndexingIterator<τ_0_0>> (@in τ_0_0) -> @out IndexingIterator<τ_0_0> // user: %30
%30 = apply %29<[PartialKeyPath<Case<Foo>>]>(%23, %27) : $@convention(method) <τ_0_0 where τ_0_0 : Collection, τ_0_0.Iterator == IndexingIterator<τ_0_0>> (@in τ_0_0) -> @out IndexingIterator<τ_0_0>
dealloc_stack %27 : $*Array<PartialKeyPath<Case<Foo>>> // id: %31
end_borrow %4 : ${ var Array<PartialKeyPath<Case<Foo>>> } // id: %32
destroy_value %3 : ${ var Array<PartialKeyPath<Case<Foo>>> } // id: %33
%34 = tuple () // user: %35
return %34 : $() // id: %35
} // end sil function '$s26swift_case_paths_benchmark3FooO12AllCasePathsV12makeIteratorQryF'
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
Stack dump:
0. Program arguments: /Users/hiroshi/Library/Developer/Toolchains/swift-5.10-RELEASE.xctoolchain/usr/bin/swift-frontend -frontend -c /Users/hiroshi/dev/devin-1441/swift-case-paths/Sources/swift-case-paths-benchmark/Common.swift -primary-file /Users/hiroshi/dev/devin-1441/swift-case-paths/Sources/swift-case-paths-benchmark/Foo.swift /Users/hiroshi/dev/devin-1441/swift-case-paths/Sources/swift-case-paths-benchmark/main.swift -emit-dependencies-path /Users/hiroshi/dev/devin-1441/swift-case-paths/.build/arm64-apple-macosx/debug/swift_case_paths_benchmark.build/Foo.d -emit-reference-dependencies-path /Users/hiroshi/dev/devin-1441/swift-case-paths/.build/arm64-apple-macosx/debug/swift_case_paths_benchmark.build/Foo.swiftdeps -target arm64-apple-macosx10.15 -Xllvm -aarch64-use-tbi -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk -I /Users/hiroshi/dev/devin-1441/swift-case-paths/.build/arm64-apple-macosx/debug -I /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib -F /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -color-diagnostics -enable-testing -g -module-cache-path /Users/hiroshi/dev/devin-1441/swift-case-paths/.build/arm64-apple-macosx/debug/ModuleCache -swift-version 5 -Onone -D SWIFT_PACKAGE -D DEBUG -new-driver-path /Users/hiroshi/Library/Developer/Toolchains/swift-5.10-RELEASE.xctoolchain/usr/bin/swift-driver -entry-point-function-name swift_case_paths_benchmark_main -load-plugin-executable /Users/hiroshi/dev/devin-1441/swift-case-paths/.build/arm64-apple-macosx/debug/CasePathsMacros#CasePathsMacros -external-plugin-path /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-plugin-server -external-plugin-path /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/local/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-plugin-server -enable-experimental-feature StrictConcurrency -empty-abi-descriptor -resource-dir /Users/hiroshi/Library/Developer/Toolchains/swift-5.10-RELEASE.xctoolchain/usr/lib/swift -enable-anonymous-context-mangled-names -Xcc -isysroot -Xcc /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk -Xcc -F -Xcc /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -Xcc -fPIC -Xcc -g -module-name swift_case_paths_benchmark -package-name swift_case_paths -target-sdk-version 14.0 -target-sdk-name macosx14.0 -external-plugin-path /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/usr/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/usr/bin/swift-plugin-server -external-plugin-path /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/usr/local/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/usr/bin/swift-plugin-server -external-plugin-path /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server -external-plugin-path /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/local/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server -plugin-path /Users/hiroshi/Library/Developer/Toolchains/swift-5.10-RELEASE.xctoolchain/usr/lib/swift/host/plugins -plugin-path /Users/hiroshi/Library/Developer/Toolchains/swift-5.10-RELEASE.xctoolchain/usr/local/lib/swift/host/plugins -o /Users/hiroshi/dev/devin-1441/swift-case-paths/.build/arm64-apple-macosx/debug/swift_case_paths_benchmark.build/Foo.swift.o -index-store-path /Users/hiroshi/dev/devin-1441/swift-case-paths/.build/arm64-apple-macosx/debug/index/store -index-system-modules
1. Apple Swift version 5.10 (swift-5.10-RELEASE)
2. Compiling with the current language version
3. While evaluating request ASTLoweringRequest(Lowering AST to SIL for file "/Users/hiroshi/dev/devin-1441/swift-case-paths/Sources/swift-case-paths-benchmark/Foo.swift")
4. While silgen emitFunction SIL function "@$s26swift_case_paths_benchmark3FooO12AllCasePathsV12makeIteratorQryF".
for 'makeIterator()' (at @__swiftmacro_26swift_case_paths_benchmark3Foo12CasePathablefMm_.swift:19:12)
5. While verifying SIL function "@$s26swift_case_paths_benchmark3FooO12AllCasePathsV12makeIteratorQryF".
for 'makeIterator()' (at @__swiftmacro_26swift_case_paths_benchmark3Foo12CasePathablefMm_.swift:19:12)
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0 swift-frontend 0x0000000105935558 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1 swift-frontend 0x0000000105934944 llvm::sys::RunSignalHandlers() + 112
2 swift-frontend 0x0000000105935b94 SignalHandler(int) + 304
3 libsystem_platform.dylib 0x0000000188cef584 _sigtramp + 56
4 libsystem_pthread.dylib 0x0000000188cbec20 pthread_kill + 288
5 libsystem_c.dylib 0x0000000188bcba30 abort + 180
6 swift-frontend 0x000000010198a4f0 swift::SILOptions::~SILOptions() + 0
7 swift-frontend 0x000000010198b4fc (anonymous namespace)::SILVerifier::visitSILFunction(swift::SILFunction*) + 2772
8 swift-frontend 0x0000000101986c54 swift::SILFunction::verify(swift::SILPassManager*, bool, bool, bool) const + 204
9 swift-frontend 0x00000001010b67a8 swift::Lowering::SILGenModule::postEmitFunction(swift::SILDeclRef, swift::SILFunction*) + 240
10 swift-frontend 0x00000001010b6064 swift::Lowering::SILGenModule::emitFunctionDefinition(swift::SILDeclRef, swift::SILFunction*) + 6104
11 swift-frontend 0x00000001010b6cd8 swift::Lowering::SILGenModule::emitOrDelayFunction(swift::SILDeclRef) + 204
12 swift-frontend 0x00000001010b4874 swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*) + 164
13 swift-frontend 0x000000010119fac8 (anonymous namespace)::SILGenType::visitFuncDecl(swift::FuncDecl*) + 28
14 swift-frontend 0x000000010119cb94 (anonymous namespace)::SILGenType::emitType() + 248
15 swift-frontend 0x000000010119cb74 (anonymous namespace)::SILGenType::emitType() + 216
16 swift-frontend 0x000000010119ca90 swift::Lowering::SILGenModule::visitNominalTypeDecl(swift::NominalTypeDecl*) + 24
17 swift-frontend 0x00000001010b9328 swift::ASTLoweringRequest::evaluate(swift::Evaluator&, swift::ASTLoweringDescriptor) const + 984
18 swift-frontend 0x000000010118f9a0 swift::SimpleRequest<swift::ASTLoweringRequest, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>> (swift::ASTLoweringDescriptor), (swift::RequestFlags)9>::evaluateRequest(swift::ASTLoweringRequest const&, swift::Evaluator&) + 148
19 swift-frontend 0x00000001010bc688 llvm::Expected<swift::ASTLoweringRequest::OutputType> swift::Evaluator::getResultUncached<swift::ASTLoweringRequest>(swift::ASTLoweringRequest const&) + 396
20 swift-frontend 0x00000001010b9c7c swift::performASTLowering(swift::FileUnit&, swift::Lowering::TypeConverter&, swift::SILOptions const&, swift::IRGenOptions const*) + 92
21 swift-frontend 0x0000000100b06f90 swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 572
22 swift-frontend 0x0000000100b170c8 withSemanticAnalysis(swift::CompilerInstance&, swift::FrontendObserver*, llvm::function_ref<bool (swift::CompilerInstance&)>, bool) + 160
23 swift-frontend 0x0000000100b093cc performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 748
24 swift-frontend 0x0000000100b0843c swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2096
25 swift-frontend 0x00000001009d0858 swift::mainEntry(int, char const**) + 2160
26 dyld 0x00000001889360e0 start + 2360
5.9.2
~/Library/Developer/Toolchains/swift-5.9.2-RELEASE.xctoolchain/usr/bin/swift test
...
public class KeyPath<Root, Value> : PartialKeyPath<Root> {
^
indirect result type mismatch!
argument: %0 = argument of bb0 : $*@_opaqueReturnTypeOf("$s26swift_case_paths_benchmark3FooO12AllCasePathsV12makeIteratorQryF", 0) __ // user: %23
expected: $*IndexingIterator<Array<PartialKeyPath<Case<Foo>>>>
SIL verification failed: entry point argument types do not match function type: matched
In function:
// Foo.AllCasePaths.makeIterator()
sil [ossa] @$s26swift_case_paths_benchmark3FooO12AllCasePathsV12makeIteratorQryF : $@convention(method) (Foo.AllCasePaths) -> @out @_opaqueReturnTypeOf("$s26swift_case_paths_benchmark3FooO12AllCasePathsV12makeIteratorQryF", 0) __ {
// %0 "$return_value" // user: %23
// %1 "self" // user: %2
bb0(%0 : $*@_opaqueReturnTypeOf("$s26swift_case_paths_benchmark3FooO12AllCasePathsV12makeIteratorQryF", 0) __, %1 : $Foo.AllCasePaths):
debug_value %1 : $Foo.AllCasePaths, let, name "self", argno 1, implicit // id: %2
%3 = alloc_box ${ var Array<PartialKeyPath<Case<Foo>>> }, var, name "allCasePaths" // users: %33, %4
%4 = begin_borrow [lexical] %3 : ${ var Array<PartialKeyPath<Case<Foo>>> } // users: %32, %5
%5 = project_box %4 : ${ var Array<PartialKeyPath<Case<Foo>>> }, 0 // users: %24, %18, %12
%6 = integer_literal $Builtin.Word, 0 // user: %8
// function_ref _allocateUninitializedArray<A>(_:)
%7 = function_ref @$ss27_allocateUninitializedArrayySayxG_BptBwlF : $@convention(thin) <τ_0_0> (Builtin.Word) -> (@owned Array<τ_0_0>, Builtin.RawPointer) // user: %8
%8 = apply %7<PartialKeyPath<Case<Foo>>>(%6) : $@convention(thin) <τ_0_0> (Builtin.Word) -> (@owned Array<τ_0_0>, Builtin.RawPointer) // user: %9
(%9, %10) = destructure_tuple %8 : $(Array<PartialKeyPath<Case<Foo>>>, Builtin.RawPointer) // users: %12, %11
%11 = pointer_to_address %10 : $Builtin.RawPointer to [strict] $*PartialKeyPath<Case<Foo>>
store %9 to [init] %5 : $*Array<PartialKeyPath<Case<Foo>>> // id: %12
%13 = keypath $KeyPath<Foo.AllCasePaths, AnyCasePath<Foo, Foo2>>, (root $Foo.AllCasePaths; gettable_property $AnyCasePath<Foo, Foo2>, id @$s26swift_case_paths_benchmark3FooO12AllCasePathsV3foo0gH003AnyG4PathVyAcA4Foo2OGvg : $@convention(method) (Foo.AllCasePaths) -> @owned AnyCasePath<Foo, Foo2>, getter @$s26swift_case_paths_benchmark3FooO12AllCasePathsV3foo0gH003AnyG4PathVyAcA4Foo2OGvpAETK : $@convention(thin) (@in_guaranteed Foo.AllCasePaths) -> @out AnyCasePath<Foo, Foo2>) // user: %14
%14 = keypath $KeyPath<Case<Foo>, Case<Foo2>>, (root $Case<Foo>; gettable_property $Case<Foo2>, id @$s9CasePaths0A0V13dynamicMemberACyqd__Gs7KeyPathCy03AllaB0QzAA03AnyaF0Vyxqd__GG_tcAA0A8PathableRzluig : $@convention(method) <τ_0_0 where τ_0_0 : CasePathable><τ_1_0> (@guaranteed KeyPath<τ_0_0.AllCasePaths, AnyCasePath<τ_0_0, τ_1_0>>, @guaranteed Case<τ_0_0>) -> @owned Case<τ_1_0>, getter @$s9CasePaths0A0V13dynamicMemberACyqd__Gs7KeyPathCy03AllaB0QzAA03AnyaF0Vyxqd__GG_tcAA0A8PathableRzluipACy26swift_case_paths_benchmark3FooOGAqO4Foo2OTK : $@convention(thin) (@in_guaranteed Case<Foo>, UnsafeRawPointer) -> @out Case<Foo2>, indices [%$0 : $KeyPath<Foo.AllCasePaths, AnyCasePath<Foo, Foo2>> : $KeyPath<Foo.AllCasePaths, AnyCasePath<Foo, Foo2>>], indices_equals @$ss7KeyPathCy26swift_case_paths_benchmark3FooO12AllCasePathsV0iJ003AnyiB0VyAeC4Foo2OGGTH : $@convention(thin) (UnsafeRawPointer, UnsafeRawPointer) -> Bool, indices_hash @$ss7KeyPathCy26swift_case_paths_benchmark3FooO12AllCasePathsV0iJ003AnyiB0VyAeC4Foo2OGGTh : $@convention(thin) (UnsafeRawPointer) -> Int, external #Case.subscript<Foo, Foo2>) (%13) // user: %15
%15 = upcast %14 : $KeyPath<Case<Foo>, Case<Foo2>> to $PartialKeyPath<Case<Foo>> // user: %17
%16 = alloc_stack $PartialKeyPath<Case<Foo>> // users: %22, %20, %17
store %15 to [init] %16 : $*PartialKeyPath<Case<Foo>> // id: %17
%18 = begin_access [modify] [unknown] %5 : $*Array<PartialKeyPath<Case<Foo>>> // users: %21, %20
// function_ref Array.append(_:)
%19 = function_ref @$sSa6appendyyxnF : $@convention(method) <τ_0_0> (@in τ_0_0, @inout Array<τ_0_0>) -> () // user: %20
%20 = apply %19<PartialKeyPath<Case<Foo>>>(%16, %18) : $@convention(method) <τ_0_0> (@in τ_0_0, @inout Array<τ_0_0>) -> ()
end_access %18 : $*Array<PartialKeyPath<Case<Foo>>> // id: %21
dealloc_stack %16 : $*PartialKeyPath<Case<Foo>> // id: %22
%23 = unchecked_addr_cast %0 : $*@_opaqueReturnTypeOf("$s26swift_case_paths_benchmark3FooO12AllCasePathsV12makeIteratorQryF", 0) __ to $*IndexingIterator<Array<PartialKeyPath<Case<Foo>>>> // user: %30
%24 = begin_access [read] [unknown] %5 : $*Array<PartialKeyPath<Case<Foo>>> // users: %26, %25
%25 = load [copy] %24 : $*Array<PartialKeyPath<Case<Foo>>> // user: %28
end_access %24 : $*Array<PartialKeyPath<Case<Foo>>> // id: %26
%27 = alloc_stack $Array<PartialKeyPath<Case<Foo>>> // users: %31, %30, %28
store %25 to [init] %27 : $*Array<PartialKeyPath<Case<Foo>>> // id: %28
// function_ref Collection<>.makeIterator()
%29 = function_ref @$sSlss16IndexingIteratorVyxG0B0RtzrlE04makeB0ACyF : $@convention(method) <τ_0_0 where τ_0_0 : Collection, τ_0_0.Iterator == IndexingIterator<τ_0_0>> (@in τ_0_0) -> @out IndexingIterator<τ_0_0> // user: %30
%30 = apply %29<[PartialKeyPath<Case<Foo>>]>(%23, %27) : $@convention(method) <τ_0_0 where τ_0_0 : Collection, τ_0_0.Iterator == IndexingIterator<τ_0_0>> (@in τ_0_0) -> @out IndexingIterator<τ_0_0>
dealloc_stack %27 : $*Array<PartialKeyPath<Case<Foo>>> // id: %31
end_borrow %4 : ${ var Array<PartialKeyPath<Case<Foo>>> } // id: %32
destroy_value %3 : ${ var Array<PartialKeyPath<Case<Foo>>> } // id: %33
%34 = tuple () // user: %35
return %34 : $() // id: %35
} // end sil function '$s26swift_case_paths_benchmark3FooO12AllCasePathsV12makeIteratorQryF'
Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
Stack dump:
0. Program arguments: /Users/hiroshi/Library/Developer/Toolchains/swift-5.9.2-RELEASE.xctoolchain/usr/bin/swift-frontend -frontend -c /Users/hiroshi/dev/devin-1441/swift-case-paths/Sources/swift-case-paths-benchmark/Common.swift -primary-file /Users/hiroshi/dev/devin-1441/swift-case-paths/Sources/swift-case-paths-benchmark/Foo.swift /Users/hiroshi/dev/devin-1441/swift-case-paths/Sources/swift-case-paths-benchmark/main.swift -emit-dependencies-path /Users/hiroshi/dev/devin-1441/swift-case-paths/.build/arm64-apple-macosx/debug/swift_case_paths_benchmark.build/Foo.d -emit-reference-dependencies-path /Users/hiroshi/dev/devin-1441/swift-case-paths/.build/arm64-apple-macosx/debug/swift_case_paths_benchmark.build/Foo.swiftdeps -target arm64-apple-macosx10.15 -Xllvm -aarch64-use-tbi -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk -I /Users/hiroshi/dev/devin-1441/swift-case-paths/.build/arm64-apple-macosx/debug -I /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib -F /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -color-diagnostics -enable-testing -g -module-cache-path /Users/hiroshi/dev/devin-1441/swift-case-paths/.build/arm64-apple-macosx/debug/ModuleCache -swift-version 5 -Onone -D SWIFT_PACKAGE -D DEBUG -new-driver-path /Users/hiroshi/Library/Developer/Toolchains/swift-5.9.2-RELEASE.xctoolchain/usr/bin/swift-driver -entry-point-function-name swift_case_paths_benchmark_main -load-plugin-executable /Users/hiroshi/dev/devin-1441/swift-case-paths/.build/arm64-apple-macosx/debug/CasePathsMacros#CasePathsMacros -external-plugin-path /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-plugin-server -external-plugin-path /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/local/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-plugin-server -enable-experimental-feature StrictConcurrency -empty-abi-descriptor -resource-dir /Users/hiroshi/Library/Developer/Toolchains/swift-5.9.2-RELEASE.xctoolchain/usr/lib/swift -enable-anonymous-context-mangled-names -Xcc -isysroot -Xcc /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk -Xcc -F -Xcc /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/Library/Frameworks -Xcc -fPIC -module-name swift_case_paths_benchmark -package-name swift_case_paths -target-sdk-version 14.0 -target-sdk-name macosx14.0 -external-plugin-path /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/usr/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/usr/bin/swift-plugin-server -external-plugin-path /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/usr/local/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.0.sdk/usr/bin/swift-plugin-server -external-plugin-path /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server -external-plugin-path /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/local/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server -plugin-path /Users/hiroshi/Library/Developer/Toolchains/swift-5.9.2-RELEASE.xctoolchain/usr/lib/swift/host/plugins -plugin-path /Users/hiroshi/Library/Developer/Toolchains/swift-5.9.2-RELEASE.xctoolchain/usr/local/lib/swift/host/plugins -o /Users/hiroshi/dev/devin-1441/swift-case-paths/.build/arm64-apple-macosx/debug/swift_case_paths_benchmark.build/Foo.swift.o -index-store-path /Users/hiroshi/dev/devin-1441/swift-case-paths/.build/arm64-apple-macosx/debug/index/store -index-system-modules
1. Apple Swift version 5.9.2 (swift-5.9.2-RELEASE)
2. Compiling with the current language version
3. While evaluating request ASTLoweringRequest(Lowering AST to SIL for file "/Users/hiroshi/dev/devin-1441/swift-case-paths/Sources/swift-case-paths-benchmark/Foo.swift")
4. While silgen emitFunction SIL function "@$s26swift_case_paths_benchmark3FooO12AllCasePathsV12makeIteratorQryF".
for 'makeIterator()' (at @__swiftmacro_26swift_case_paths_benchmark3Foo12CasePathablefMm_.swift:19:12)
5. While verifying SIL function "@$s26swift_case_paths_benchmark3FooO12AllCasePathsV12makeIteratorQryF".
for 'makeIterator()' (at @__swiftmacro_26swift_case_paths_benchmark3Foo12CasePathablefMm_.swift:19:12)
Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
0 swift-frontend 0x00000001097c5584 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1 swift-frontend 0x00000001097c4928 llvm::sys::RunSignalHandlers() + 112
2 swift-frontend 0x00000001097c5bc4 SignalHandler(int) + 304
3 libsystem_platform.dylib 0x0000000188cef584 _sigtramp + 56
4 libsystem_pthread.dylib 0x0000000188cbec20 pthread_kill + 288
5 libsystem_c.dylib 0x0000000188bcba30 abort + 180
6 swift-frontend 0x00000001058b9ed0 (anonymous namespace)::SILVerifier::_require(bool, llvm::Twine const&, std::__1::function<void ()> const&) + 1476
7 swift-frontend 0x00000001058baf74 (anonymous namespace)::SILVerifier::visitSILFunction(swift::SILFunction*) + 2628
8 swift-frontend 0x00000001058b65a8 swift::SILFunction::verify(bool, bool, bool) const + 200
9 swift-frontend 0x00000001050345bc swift::Lowering::SILGenModule::postEmitFunction(swift::SILDeclRef, swift::SILFunction*) + 236
10 swift-frontend 0x0000000105032d3c swift::Lowering::SILGenModule::emitFunctionDefinition(swift::SILDeclRef, swift::SILFunction*) + 3984
11 swift-frontend 0x00000001050354a4 emitOrDelayFunction(swift::Lowering::SILGenModule&, swift::SILDeclRef) + 200
12 swift-frontend 0x0000000105031d94 swift::Lowering::SILGenModule::emitFunction(swift::FuncDecl*) + 164
13 swift-frontend 0x0000000105114c58 (anonymous namespace)::SILGenType::visitFuncDecl(swift::FuncDecl*) + 28
14 swift-frontend 0x0000000105111b54 (anonymous namespace)::SILGenType::emitType() + 140
15 swift-frontend 0x0000000105114788 swift::ASTVisitor<(anonymous namespace)::SILGenType, void, void, void, void, void, void>::visit(swift::Decl*) + 96
16 swift-frontend 0x0000000105111b54 (anonymous namespace)::SILGenType::emitType() + 140
17 swift-frontend 0x0000000105111abc swift::Lowering::SILGenModule::visitNominalTypeDecl(swift::NominalTypeDecl*) + 24
18 swift-frontend 0x0000000105037448 swift::ASTLoweringRequest::evaluate(swift::Evaluator&, swift::ASTLoweringDescriptor) const + 1004
19 swift-frontend 0x000000010510614c swift::SimpleRequest<swift::ASTLoweringRequest, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>> (swift::ASTLoweringDescriptor), (swift::RequestFlags)9>::evaluateRequest(swift::ASTLoweringRequest const&, swift::Evaluator&) + 148
20 swift-frontend 0x000000010503b290 llvm::Expected<swift::ASTLoweringRequest::OutputType> swift::Evaluator::getResultUncached<swift::ASTLoweringRequest>(swift::ASTLoweringRequest const&) + 396
21 swift-frontend 0x000000010503870c swift::performASTLowering(swift::FileUnit&, swift::Lowering::TypeConverter&, swift::SILOptions const&, swift::IRGenOptions const*) + 100
22 swift-frontend 0x0000000104b12890 swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 524
23 swift-frontend 0x0000000104b21888 withSemanticAnalysis(swift::CompilerInstance&, swift::FrontendObserver*, llvm::function_ref<bool (swift::CompilerInstance&)>, bool) + 160
24 swift-frontend 0x0000000104b14458 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2848
25 swift-frontend 0x0000000104999354 swift::mainEntry(int, char const**) + 3256
26 dyld 0x00000001889360e0 start + 2360
[307/348] Compiling swift_case_paths_benchmark main.swift
error: fatalError
I was able to reduce the issue to this line: https://github.com/pointfreeco/swift-case-paths/pull/159/commits/51baf3c1e862bb7964e99ebce915d2f9cc92d66c
The workaround:
-public func makeIterator() -> some IteratorProtocol<PartialCaseKeyPath<\(enumName)>> {
+public func makeIterator() -> IndexingIterator<[PartialCaseKeyPath<\(enumName)>]> {
So it appears to be an issue with a macro generating opaque return types.
I unfortunately haven't had a ton of luck reproducing the issue in a fresh macro project.
Description
I have a project that has CI against Apple platforms, as well as Linux and Windows, and noticed that a change to a macro suddenly caused the Windows build to fail. @compnerd said it seems like a generic issue and not Windows-specific. I unfortunately do not have a custom debug build to work with to reduce things, but I can link to the PR that introduces the problem:
https://github.com/pointfreeco/swift-case-paths/pull/159
Reproduction
case-path-iteration
branch.swift test
on it using a debug buildStack dump
Expected behavior
No crash.
Environment
5.10+
Additional information
No response