<html><head><meta http-equiv="Content-Type" content="text/html; charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; line-break: after-white-space;" class=""><br class=""><div><br class=""><blockquote type="cite" class=""><div class="">On Sep 28, 2017, at 2:16 PM, Sam Ding via swift-dev <<a href="mailto:swift-dev@swift.org" class="">swift-dev@swift.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><p class=""><font size="2" class="">I am testing a test case "KeyPath.swift" on s390x for v4.0 . It is found that " Builtin.loadRaw" as the below of </font><br class=""><font size="2" class=""> "stdlib/public/core/UnsafeRawPointer.swift.gyb" returns a different value than that on x86-64. </font><br class="">
</p><ul class=""><font size="2" class=""> @_inlineable</font><br class=""><font size="2" class=""> public func load<T>(fromByteOffset offset: Int = 0, as type: T.Type) -> T {</font><br class=""><font size="2" class=""> _debugPrecondition(0 == (UInt(bitPattern: self + offset)</font><br class=""><font size="2" class=""> & (UInt(MemoryLayout<T>.alignment) - 1)),</font><br class=""><font size="2" class=""> "load from misaligned raw pointer")</font><br class=""><font size="2" class=""> </font><br class=""><font size="2" class=""> return </font><font size="2" color="#0000FF" class="">Builtin.loadRaw</font><font size="2" class="">((self + offset)._rawValue) // return a different value on s390x vs x86-64</font><br class=""><font size="2" class=""> }</font><br class=""></ul><font size="2" class="">My debugger (lldb) does not guide me to the detailed of " </font><font size="2" color="#0000FF" class="">Builtin.loadRaw</font><font size="2" class="">". Searching "loadRaw" and finding</font><ul class=""><font size="2" class=""> swift/include/swift/AST/Builtins.def:</font><font size="2" color="#001FE2" class="">BUILTIN_SIL_OPERATION(LoadRaw, "loadRaw", Special)</font><font size="2" class=""> </font></ul><br class=""><font size="2" class="">But I could not find the definition of this "</font><font size="2" color="#001FE2" class="">LoadRaw</font><font size="2" class="">" from the whole swift v4.</font><br class=""><font size="2" class="">Can anyone give me a hint where its implementation is?</font><br class=""></div></div></blockquote></div><br class=""><div class="">Builtins don't have any definition in Swift; they're lowered directly by the compiler. UnsafeRawPointer.load loads a value from memory at the address referenced by the pointer's value. The pointer may be getting miscalculated because of layout assumptions that hold on other platforms but not s390x.</div><div class=""><br class=""></div><div class="">-Joe</div></body></html>