Hi,

It is found that "for" loop iterate and "enum" does not work on s390x.
Here is a sample code:

      enum IntKey : Int {
          case a = 3
          case b = 4 // Implicitly 4
          case c = 1
      }
      for ( a1, a2) in [(IntKey.a, 1)] {
         print ("+++++  test \n")
      }

The for loop  inifinitly iterates on s390x. Note that it works fine if
replacing the enum with normal tuple in the above code.
When debugging this code, after one iteration, the logic gets a "nil" in "
IndexingIterator.next()" as follows:

      ....
       frame #0: 0x000003fffd5b4088 libswiftCore.so`IndexingIterator.next
   (self=0x000003fffffff460) at Collection.swift:411
      408    @inline(__always)
      409    public mutating func next() -> Elements.Element? {
      410      if _position == _elements.endIndex {
   -> 411          return nil
      412      }
      413      let element = _elements[_position]
   ..
Then comes "Enum.cpp:211" (swift::swift_storeEnumTagSinglePayload) and no
difference  on both s390x and x86_64.
However, It continues goes into the loop body on s390x, and  terminates  on
x86_64, respectively.

Have anyones know well this implementation and give us a hint for the
problems?

Thanks,


Sam Ding,
Linux on z Systems  Open Source Ecosystem
IBM Toronto Lab,
email: samd...@ca.ibm.com
phone: (905)413-2947
_______________________________________________
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev

Reply via email to