Linux Swift: Strange bug found in a simple arithmetic

Hi

This simple instruction can take more than 20 seconds to execute 

and near 100% CPU on different Linux Swift version I tested.

Also tested in compiled mode with the same result.

      let simpleTest = Float(abs(11 - -3) + abs(4.5 -

-4)) //!

  print ("simpleTest:  \(Simpletest)")

  I know that a many variations can cause more or less results I

can't determine if Float or abs is the culprit.

  Do someone have an idea on this ?

Thank you

···

--

Louis Plouffe

We'd appreciate some more information on how exactly you're compiling the above code. Are you running it as a script with `swift`, or compiling it then executing it? Are you optimizing? Running a script with `swift` will include type checking and code generation time, and we have some known compiler performance issues with heavily-overloaded operators such as the numeric operators.

-Joe

···

On Sep 7, 2016, at 6:47 AM, louislepegue via swift-dev <swift-dev@swift.org> wrote:

Hi

This simple instruction can take more than 20 seconds to execute and near 100% CPU on different Linux Swift version I tested.
Also tested in compiled mode with the same result.

let simpleTest = Float(abs(11 - -3) + abs(4.5 - -4)) //!
print ("simpleTest: \(Simpletest)")

I know that a many variations can cause more or less results I can't determine if Float or abs is the culprit.

Do someone have an idea on this ?