Re:Will It Optimize? See how well you can anticipate gcc's o...
by haberman on Sunday April 07, 2013 @07:32PM
(#5509206)
It's possible that both were "correct" but that -O2 and -O3 gave different results due to x86 extended precision. For some interesting reading, see:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=323 (a centi-bug of back and forth between "it's broken!" and "no it's not, and we're not going to change the compiler.")
http://gcc.gnu.org/ml/gcc/2003-08/msg01183.html (a really informative thread about the issue)
Re:Will It Optimize? See how well you can anticipate gcc's o...
by widdershins on Sunday April 07, 2013 @07:07PM
(#5509126)
Really? Wow, I thought optimisations had to provably avoid affecting the correctness of your program. Hence:
"This need to avoid imprecise intermediate results often prevents compilers from exploiting mathematical properties like associativity when optimizing FP arithmetic."
from the explanation under Q4.
Cost: one sleepless night in college."What do you mean, optimization doesn't just make it faster?!?"