Skip to content

Commit 67d41ac

Browse files
committed
[test] fix a memory allocation’s alignment
it seems this would have failed on 32bit with strict alignment enforcement
1 parent 4e36f56 commit 67d41ac

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

test/stdlib/UnsafeRawBufferPointer.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,10 @@ UnsafeRawBufferPointerTestSuite.test("initializeMemory(as:from:).overflow") {
164164
#endif
165165

166166
UnsafeRawBufferPointerTestSuite.test("initializeMemory(as:from:).exact") {
167-
let buffer = UnsafeMutableRawBufferPointer.allocate(byteCount: 24, alignment: MemoryLayout<UInt>.alignment)
167+
let buffer = UnsafeMutableRawBufferPointer.allocate(
168+
byteCount: 3*MemoryLayout<Int64>.stride,
169+
alignment: MemoryLayout<Int64>.alignment
170+
)
168171
defer { buffer.deallocate() }
169172
let source: [Int64] = [5, 4, 3]
170173
var (it,bound) = buffer.initializeMemory(as: Int64.self, from: source)

0 commit comments

Comments
 (0)