It's a programmer that made the optimization in the first place, so obviously a programmer get's the blame. However, it's not always the fault of someone writing for (e.g.) the Linux kernel that should be blamed for an optimization that was written into the compiler. How many optimizations have been put into gcc since the first stable release? Do you expect everyone who compiles code with gcc to know about all those optimizations?
On the other hand, you can't expect everyone who writes compiler optimizations to know every consequence of the optimization on every piece of code that's ever compiled and touches that code-path. There could be any number of variations of code that use the optimization without a single bug appearing, but just one that uses it (correctly) and produces a bug for no apparent reason.
That is why a zero-optimized build (which you can do with gcc too, btw) is useful: it allows you to catch bugs in code that are caused solely by optimizations, and whose root may be in the compiler itself. clang/llvm can be useful in a similar way: If it's written well, it can be used to find bugs (in the compiler or the program itself) which prevent a program from compiling correctly in gcc.



Reply With Quote