<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 29, 2017, at 8:08 AM, Sam Ding <<a href="mailto:samding@ca.ibm.com" class="">samding@ca.ibm.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div class=""><p class=""><font size="2" class="">Hi Slava & Joe,</font><br class=""><br class=""><font size="2" class="">Thank you for the response.</font><br class=""><br class=""><font size="2" class="">The failed test case is "generic instantiation" of KeyPath.swift. Here is details of log:</font></p><ul class=""><ul class=""><font size="2" class="">[ RUN ] key paths.key path generic instantiation</font><br class=""><font size="2" class="">stdout>>> check failed at /home/wk/sw4/swift/test/stdlib/KeyPath.swift, line 193</font><br class=""><font size="2" class="">stdout>>> expected: Swift.ReferenceWritableKeyPath<a.S<Swift.Int>, Swift.Int> (of type Swift.ReferenceWritableKeyPath<a.S<Swift.Int>, Swift.Int>)</font><br class=""><font size="2" class="">stdout>>> actual: Swift.ReferenceWritableKeyPath<a.S<Swift.Int>, Swift.Int> (of type Swift.ReferenceWritableKeyPath<a.S<Swift.Int>, Swift.Int>)</font><br class=""><font size="2" class="">stdout>>> check failed at /home/wk/sw4/swift/test/stdlib/KeyPath.swift, line 197</font><br class=""><font size="2" class="">stdout>>> expected: Swift.ReferenceWritableKeyPath<a.S<Swift.String>, Swift.Int> (of type Swift.ReferenceWritableKeyPath<a.S<Swift.String>, Swift.Int>)</font><br class=""><font size="2" class="">stdout>>> actual: Swift.ReferenceWritableKeyPath<a.S<Swift.String>, Swift.Int> (of type Swift.ReferenceWritableKeyPath<a.S<Swift.String>, Swift.Int>)</font><br class=""><font size="2" class="">stdout>>> check failed at /home/wk/sw4/swift/test/stdlib/KeyPath.swift, line 201</font><br class=""><font size="2" class="">stdout>>> expected: Swift.ReferenceWritableKeyPath<a.S<StdlibUnittest.LifetimeTracked>, Swift.Int> (of type Swift.ReferenceWritableKeyPath<a.S<StdlibUnittest.LifetimeTracked>, Swift.Int>)</font><br class=""><font size="2" class="">stdout>>> actual: Swift.ReferenceWritableKeyPath<a.S<StdlibUnittest.LifetimeTracked>, Swift.Int> (of type Swift.ReferenceWritableKeyPath<a.S<StdlibUnittest.LifetimeTracked>, Swift.Int>)</font><br class=""><font size="2" class="">[ FAIL ] key paths.key path generic instantiation</font></ul></ul><br class=""><font size="2" class="">Other test cases of KeyPath.siwft are all passed. </font><br class=""><font size="2" class="">It is found that the failure reason is @stdlib/public/core/KeyPath.swift</font><br class="">
<ul class=""><ul class=""><font size="2" class=""> 85 if aComponent.header.endOfReferencePrefix</font><br class=""><font size="2" class=""> 86 != bComponent.header.endOfReferencePrefix</font><br class=""><font size="2" class=""> 87 ||</font><b class=""><font size="2" class=""> aComponent.value != bComponent.value</font></b><font size="2" class=""> </font><font size="2" color="#0000FF" class="">// this is true on s390x, aComponent.value="struct(0)", bComponent.value="struct(48)"</font><br class=""><font size="2" class=""> 88 || aType != bType {</font><br class=""><font size="2" class=""> 89 return false</font><br class=""><font size="2" class=""> 90 }</font></ul></ul><br class=""><font size="2" class="">Then tracing to:</font><br class="">
<ul class=""><font size="2" class="">2094 func tryToResolveOffset() {</font><br class=""><font size="2" class="">2095 if header.payload == RawKeyPathComponent.Header.unresolvedFieldOffsetPayload {</font><br class=""><font size="2" class="">2096 // Look up offset in type metadata. The value in the pattern is the</font><br class=""><font size="2" class="">2097 // offset within the metadata object.</font><br class=""><font size="2" class="">2098 let metadataPtr = unsafeBitCast(base, to: UnsafeRawPointer.self)</font><br class=""><font size="2" class="">2099 let offsetOfOffset = patternBuffer.pop(UInt32.self)</font><br class=""><font size="2" class="">2100 print("+++++++++++ int_offsetOfOffset=\(Int(offsetOfOffset))\n")</font><br class=""><font size="2" class="">2101 </font><b class=""><font size="2" class="">var offset = metadataPtr.load(fromByteOffset: Int(offsetOfOffset), </font></b><font size="2" color="#0000FF" class=""> // given the same input parameters (offsetOfOfferset=56), </font><br class=""><b class=""><font size="2" class="">2102 as: UInt32.self) // </font></b><font size="2" color="#0000FF" class=""> different "offset" (0 on s390x, and 48 on x86_64)</font><br class=""><font size="2" class="">2103 // Rewrite the header for a resolved offset.</font></ul><br class=""><br class=""><font size="2" class="">Then it comes </font><font size="2" color="#0000FF" class="">Builtin.loadRaw</font><font size="2" class=""> of </font><font size="2" class="">UnsafeRawPointer.swift.gyb</font><br class=""><br class=""><font size="2" class="">As My lldb and gdb do not stop @ </font>emitBuiltinLoadRaw()<font size="2" class="">, </font><br class=""><font size="2" class="">I inserted a "printf" in the fucntion, but it does not print out anything.</font><br class=""><br class=""><font size="2" class="">Yes, I think it maybe related to </font>alignment or endianness<font size="2" class="">, so we need to find the source code of LoadRaw.</font><br class=""></div></div></blockquote></div><br class=""><div class="">I think you're focusing on the wrong level of abstraction. It is extremely unlikely that the implementation of UnsafeRawPointer.load is incorrect, because otherwise nothing would work. You should understand UnsafeRawPointer.load as a primitive operation, like *(uint32_t*)((char*)metadataPtr + offsetOfOffset) in C, and look at the address that's being computed and the memory layout of the KeyPath object being interpreted and how it differs on s390x vs. other platforms.</div><div class=""><br class=""></div><div class="">-Joe</div></body></html>