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

SIL verification failure of key paths, only on Windows #67676

Open
ahoppen opened this issue Aug 2, 2023 · 0 comments
Open

SIL verification failure of key paths, only on Windows #67676

ahoppen opened this issue Aug 2, 2023 · 0 comments
Labels
assertion failure Bug → crash: An assertion failure compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software SIL swift 5.9 verifier Windows Platform: Windows

Comments

@ahoppen
Copy link
Contributor

ahoppen commented Aug 2, 2023

CI testing of the following PR gives me a SIL verification failure on Windows only. The build works fine on macOS and Linux. apple/swift-syntax#1921

SIL verification failed: operand must match type required by pattern

Verifying instruction:
     %5 = alloc_stack $SyntaxChildrenIndex        // users: %9, %7, %6
->   %7 = keypath $WritableKeyPath<Self, Self.Element>, <Ï„_0_0 where Ï„_0_0 : SyntaxCollection> (root $Ï„_0_0; settable_property $Ï„_0_0.Element,  id @$s11SwiftSyntax0B10CollectionPAAEy7ElementQzAA0B13ChildrenIndexVcig : $@convention(method) <Ï„_0_0 where Ï„_0_0 : SyntaxCollection> (@in_guaranteed SyntaxChildrenIndex, @in_guaranteed Ï„_0_0) -> @out Ï„_0_0.Element, getter @$s11SwiftSyntax0B10CollectionPAAEy7ElementQzAA0B13ChildrenIndexVcipAaBRzlxxTK : $@convention(thin) <Ï„_0_0 where Ï„_0_0 : SyntaxCollection> (@in_guaranteed Ï„_0_0, UnsafeRawPointer) -> @out Ï„_0_0.Element, setter @$s11SwiftSyntax0B10CollectionPAAEy7ElementQzAA0B13ChildrenIndexVcipAaBRzlxxTk : $@convention(thin) <Ï„_0_0 where Ï„_0_0 : SyntaxCollection> (@in_guaranteed Ï„_0_0.Element, @inout Ï„_0_0, UnsafeRawPointer) -> (), indices [%$0 : $SyntaxChildrenIndex : $SyntaxChildrenIndex], indices_equals @$s11SwiftSyntax0B13ChildrenIndexVAA0B10CollectionRzlTH : $@convention(thin) <Ï„_0_0 where Ï„_0_0 : SyntaxCollection> (UnsafeRawPointer, UnsafeRawPointer) -> Bool, indices_hash @$s11SwiftSyntax0B13ChildrenIndexVAA0B10CollectionRzlTh : $@convention(thin) <Ï„_0_0 where Ï„_0_0 : SyntaxCollection> (UnsafeRawPointer) -> Int) <Self> (%5) // user: %8
     %8 = upcast %7 : $WritableKeyPath<Self, Self.Element> to $AnyKeyPath // user: %10
In function:
// SyntaxCollection.keyPath(for:)
sil private [ossa] @$s11SwiftSyntax0B10CollectionPAAE7keyPath33_B3300DB0BA2B3E5E35A338B811650793LL3fors06AnyKeyE0CAA0B13ChildrenIndexV_tF : $@convention(method) <Self where Self : SyntaxCollection> (@in_guaranteed SyntaxChildrenIndex, @in_guaranteed Self) -> @owned AnyKeyPath {
// %0 "index"                                     // user: %2
// %1 "self"                                      // user: %4
bb0(%0 : $*SyntaxChildrenIndex, %1 : $*Self):
  %2 = load [trivial] %0 : $*SyntaxChildrenIndex  // users: %6, %3
  debug_value %2 : $SyntaxChildrenIndex, let, name "index", argno 1 // id: %3
  debug_value %1 : $*Self, let, name "self", argno 2, implicit, expr op_deref // id: %4
  %5 = alloc_stack $SyntaxChildrenIndex           // users: %9, %7, %6
  store %2 to [trivial] %5 : $*SyntaxChildrenIndex // id: %6
  %7 = keypath $WritableKeyPath<Self, Self.Element>, <Ï„_0_0 where Ï„_0_0 : SyntaxCollection> (root $Ï„_0_0; settable_property $Ï„_0_0.Element,  id @$s11SwiftSyntax0B10CollectionPAAEy7ElementQzAA0B13ChildrenIndexVcig : $@convention(method) <Ï„_0_0 where Ï„_0_0 : SyntaxCollection> (@in_guaranteed SyntaxChildrenIndex, @in_guaranteed Ï„_0_0) -> @out Ï„_0_0.Element, getter @$s11SwiftSyntax0B10CollectionPAAEy7ElementQzAA0B13ChildrenIndexVcipAaBRzlxxTK : $@convention(thin) <Ï„_0_0 where Ï„_0_0 : SyntaxCollection> (@in_guaranteed Ï„_0_0, UnsafeRawPointer) -> @out Ï„_0_0.Element, setter @$s11SwiftSyntax0B10CollectionPAAEy7ElementQzAA0B13ChildrenIndexVcipAaBRzlxxTk : $@convention(thin) <Ï„_0_0 where Ï„_0_0 : SyntaxCollection> (@in_guaranteed Ï„_0_0.Element, @inout Ï„_0_0, UnsafeRawPointer) -> (), indices [%$0 : $SyntaxChildrenIndex : $SyntaxChildrenIndex], indices_equals @$s11SwiftSyntax0B13ChildrenIndexVAA0B10CollectionRzlTH : $@convention(thin) <Ï„_0_0 where Ï„_0_0 : SyntaxCollection> (UnsafeRawPointer, UnsafeRawPointer) -> Bool, indices_hash @$s11SwiftSyntax0B13ChildrenIndexVAA0B10CollectionRzlTh : $@convention(thin) <Ï„_0_0 where Ï„_0_0 : SyntaxCollection> (UnsafeRawPointer) -> Int) <Self> (%5) // user: %8
  %8 = upcast %7 : $WritableKeyPath<Self, Self.Element> to $AnyKeyPath // user: %10
  dealloc_stack %5 : $*SyntaxChildrenIndex        // id: %9
  return %8 : $AnyKeyPath                         // id: %10
} // end sil function '$s11SwiftSyntax0B10CollectionPAAE7keyPath33_B3300DB0BA2B3E5E35A338B811650793LL3fors06AnyKeyE0CAA0B13ChildrenIndexV_tF

rdar://112552022

@ahoppen ahoppen added Windows Platform: Windows SIL labels Aug 2, 2023
@AnthonyLatsis AnthonyLatsis added compiler The Swift compiler in itself verifier crash Bug: A crash, i.e., an abnormal termination of software swift 5.9 assertion failure Bug → crash: An assertion failure labels Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
assertion failure Bug → crash: An assertion failure compiler The Swift compiler in itself crash Bug: A crash, i.e., an abnormal termination of software SIL swift 5.9 verifier Windows Platform: Windows
Projects
None yet
Development

No branches or pull requests

2 participants