News for hackers. Stuff that matters.
Re:Weird compiler bug – Same code, different results by wiml on Friday January 29, 2021 @05:00PM (#25963257)
Some kind of internal state specific to Microsoft's libm? It doesn't look like _fpreset() is present anywhere else.

Though in general, IEEE-754 math does have a small amount of global state, for stuff like rounding modes and subnormals. Perhaps the spawned thread's fenv was unexpected.

I'm not super convinced by this blog post anyway, since it immediately confuses associativity with commutativity.

Re:Weird compiler bug – Same code, different results by zaitanz on Friday January 29, 2021 @06:13PM (#25964084)
Op here. Yea this only occurs on Windows with MinGW. Visual C++ and Clang do not have this issue. None of the Linux compilers I tested also had this issue.

And yea you're right on the associative mistake. Will correct this :)

Re:Weird compiler bug – Same code, different results by chrchang523 on Friday January 29, 2021 @08:15PM (#25964996)
I currently build Windows binaries via cross-compilation on Linux using gcc-mingw-w64; I assume that is affected by the bug?
Re:Weird compiler bug – Same code, different results by zaitanz on Friday January 29, 2021 @08:21PM (#25965040)
Most likely. You can check with the pastebin code https://pastebin.com/thTapSgn . Local and Thread outputs should be the same.