Skip to content

Commit a868cfb

Browse files
authored
Merge pull request swiftlang#25329 from linux-on-ibm-z/s390x-keypathmultimodule-fix
Fix for KeyPathMultiModule test failure
2 parents 7fd19f3 + 6ac15e9 commit a868cfb

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

stdlib/public/core/KeyPath.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2507,7 +2507,7 @@ internal enum KeyPathPatternStoredOffset {
25072507
case inline(UInt32)
25082508
case outOfLine(UInt32)
25092509
case unresolvedFieldOffset(UInt32)
2510-
case unresolvedIndirectOffset(UnsafePointer<UInt32>)
2510+
case unresolvedIndirectOffset(UnsafePointer<UInt>)
25112511
}
25122512
internal struct KeyPathPatternComputedArguments {
25132513
var getLayout: KeyPathComputedArgumentLayoutFn
@@ -2602,7 +2602,7 @@ internal func _walkKeyPathPattern<W: KeyPathPatternVisitor>(
26022602
as: Int32.self)
26032603
let ptr = _resolveRelativeIndirectableAddress(base, relativeOffset)
26042604
offset = .unresolvedIndirectOffset(
2605-
ptr.assumingMemoryBound(to: UInt32.self))
2605+
ptr.assumingMemoryBound(to: UInt.self))
26062606
default:
26072607
offset = .inline(header.storedOffsetPayload)
26082608
}
@@ -3151,7 +3151,8 @@ internal struct InstantiateKeyPathBuffer : KeyPathPatternVisitor {
31513151
case .unresolvedIndirectOffset(let pointerToOffset):
31523152
// Look up offset in the indirectly-referenced variable we have a
31533153
// pointer.
3154-
let offset = UInt32(pointerToOffset.pointee)
3154+
assert(pointerToOffset.pointee <= UInt32.max)
3155+
let offset = UInt32(truncatingIfNeeded: pointerToOffset.pointee)
31553156
let header = RawKeyPathComponent.Header(storedWithOutOfLineOffset: kind,
31563157
mutable: mutable)
31573158
pushDest(header)

0 commit comments

Comments
 (0)