On 26/11/13 11:37, Mark Haase wrote:
Compiler developers, for better or worse, reserve the right to do whatever they want with undefined behavior, and it's up to the person writing the C code to not include undefined behavior in their own program.
That's a fallacy. The fact that a compiler does not violate the standard does not imply it is behaving sane. Thus, not violating the standard does not imply not having a bug.
Considering a programmer would not ever *ever* want to fall into undefined behavior, the compiler should just issue warnings before making any kind of assumptions based after undefined behavior. Those warnings could be silenced with flags. This is a way of "yes, I'm sure of what I'm doing".
Therefore, a Linux distribution has 2 choices: (1) wait for upstream patches for bugs/vulnerabilities as they are found, or (2) recompile all packages with optimizations disabled. I don't think proposal #2 would get very far...
What about adding cppcheck warnings and gcc -Wall -pedantic be added to Lintian?
Or what about changing debhelper to pass some -f flags by default?