<html><body><p><font size="2">Hi,</font><br><br><font size="2">It is found that "for" loop iterate and "enum" does not work on s390x.</font><br><font size="2">Here is a sample code:</font><br>
<ul><ul><font size="2" color="#001FE2">enum IntKey : Int {</font><br><font size="2" color="#001FE2"> case a = 3</font><br><font size="2" color="#001FE2"> case b = 4 // Implicitly 4</font><br><font size="2" color="#001FE2"> case c = 1</font><br><font size="2" color="#001FE2">}</font><br><font size="2" color="#001FE2">for ( a1, a2) in [(IntKey.a, 1)] {</font><br><font size="2" color="#001FE2"> print ("+++++ test \n")</font><br><font size="2" color="#001FE2">} </font></ul></ul><br><font size="2">The for loop inifinitly iterates on s390x. Note that it works fine if replacing the enum with normal tuple in the above code.</font><br><font size="2">When debugging this code, after one iteration, the logic gets a "nil" in "</font><font size="2" color="#006000">IndexingIterator.next</font><font size="2">()" as follows:</font><br>
<ul><font size="2" color="#006000"> ....</font><br><font size="2" color="#006000"> frame #0: 0x000003fffd5b4088 libswiftCore.so`IndexingIterator.next(self=0x000003fffffff460) at </font><b><font size="2" color="#006000">Collection.swift:411</font></b><br><font size="2" color="#006000"> 408 @inline(__always)</font><br><font size="2" color="#006000"> 409 public mutating func next() -> Elements.Element? {</font><br><font size="2" color="#006000"> 410 if _position == _elements.endIndex {</font><br><font size="2" color="#006000">-> 411 </font><b><font size="2" color="#006000"> return nil</font></b><br><font size="2" color="#006000"> 412 }</font><br><font size="2" color="#006000"> 413 let element = _elements[_position]</font><br><font size="2">..</font></ul><font size="2">Then comes "Enum.cpp:211" (swift::swift_storeEnumTagSinglePayload) and no difference on both s390x and x86_64.</font><br><font size="2">However, It continues goes into the loop body on s390x, and terminates on x86_64, respectively.</font><br><br><font size="2">Have anyones know well this implementation and give us a hint for the problems?</font><br><br><font size="2">Thanks,</font><br><br><br><font size="2">Sam Ding,</font><br><font size="2">Linux on z Systems Open Source Ecosystem</font><br><font size="2">IBM Toronto Lab, <br></font><font size="2" color="#0000FF">email: </font><font size="2">samding@ca.ibm.com</font><br><font size="2" color="#0000FF">phone:</font><font size="2"> (905)413-2947</font><BR>
</body></html>