Stolen from a hellsite user
@soatok @RueNahcMohr A long time ago in a simpler time, I was responsible for compiling my org’s copy of a common simulation program written in Fortran. I compiled with --02, and the build tests all failed.
Compiled with --O3 (a superset of O2 with unsafe optimizations) and suddenly everything was correct and the build tests all passed. I have a few users test with known-good benchmark values, and they are happy.
To this day I still have no idea what in the world was going on. It wasn’t even a weird compiler either, it was whatever the stable version of gfortran was at that time. Can confirm, compiler optimizations are black magic.