by wglb · 16y ago · 0 comments
The statement This is, simply put, appalling advice. regarding the advice to try lowering the optimization level to see if the heisenberg goes away. The headline here uses the word "blame" but the referenced article has a headline of When you see a heisenbug in C, suspect your compiler’s optimizer.
Having written a couple of compilers and used many, I agree with the advice to "suspect" the optimization level. Try the lower level, but keep in mind that it could either be a lucky rearrangement of your particular code or a bug in the optimizer.
The -O3 level is widely held to be risky. To me, this means that there is risk of bad code generated, not risk of the resulting program being too fast.
I think the realistic estimate of the probability of errors in gcc is either 1.0 or approaches 1.0, and with -O3 it is not lower.
Yes, lots of people compile lots of programs with gcc and g++, but every shop I have seen has a set of coding standards that suggest or demand avoidance of certain features.
There is a test of a program or specification that gives you a choice between 1) Obviously no deficiencies or 2) No obvious deficiencies. Doesn't seem to me that gcc/g++ (or any other competing compiler) fits either of these criteria.
I've been a blamer of tools as well, but I've convinced myself that it's ultimately wasted effort to do so. Better to simply come to terms with the fact that there do exist bad tools, that they ought to be avoided when reasonable, and that they should be used with care when necessary.
So really "fixed" in this note I guess translates as "moved away from".