Re:Weird compiler bug – Same code, different results
by zaitanz on Friday January 29, 2021 @06:16PM
(#25964105)
Yes this is technically true, but it manifests itself through use of the MinGW compiler. When I first noticed the problem, there was very little indication as to the cause.
TBH I accredit dumb luck more than anything to finding the cause of this. It took many hours.
It's not a compiler bug, it's not a problem in C/C++, or even in IEEE-754 floating point math. The MinGW64 thread library simply forgot to initialize the FPU correctly.
He'd have had the same problem if he wrote his code in assembly language and then ran it in a MinGW64 thread.