Skip to content

Commit 12f3d46

Browse files
authored
Merge pull request #4293 from atrick/swift-3.0-branch
Fix UnsafeRawPointer.load to use Builtin.loadRaw.
2 parents c2caba6 + 8853015 commit 12f3d46

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

stdlib/public/core/UnsafeRawPointer.swift.gyb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ public struct Unsafe${Mutable}RawPointer : Strideable, Hashable, _Pointer {
367367
& (UInt(MemoryLayout<T>.alignment) - 1)),
368368
"load from misaligned raw pointer")
369369

370-
return Builtin.load((self + offset)._rawValue)
370+
return Builtin.loadRaw((self + offset)._rawValue)
371371
}
372372

373373
% if mutable:

test/SILGen/unsafe_pointer_gen.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// RUN: %target-swift-frontend -O -emit-sil -parse-as-library %s | %FileCheck %s
2+
3+
// Test the absence of a 'strict' flag.
4+
// CHECK-LABEL: _TF18unsafe_pointer_gen13test_raw_loadFT2rpSV_Si
5+
// CHECK: pointer_to_address {{%.*}} : $Builtin.RawPointer to $*Int
6+
public func test_raw_load(rp: UnsafeRawPointer) -> Int {
7+
return rp.load(as: Int.self)
8+
}

0 commit comments

Comments
 (0)