4 ms·
Since, according to Chandler Carruth, the aim for Clang is to not do optimizations based on undefined behaviour without a corresponding instrument in ubsan[0],
by nly 11y ago
Since, according to Chandler Carruth, the aim for Clang is to not do optimizations based on undefined behaviour without a corresponding instrument in ubsan[0], I don't see much traction on this well-defined/boring C effort.
You know, in my experience, things would be great if people actually turned on warnings. I write all my new code with -Weverything with a few noise categories turned off. Everybody should build code at this level from day 1.
[0] http://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html http://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html
- regehr 11y agoFor new code and for actively maintained old code you are perfectly correct. But there is a huge amount of C code we still rely on that isn't getting enough attention and I don't want that getting broken either.
- regehr 11y agoAlso we're all waiting for the strict aliasing checker.
- dietrichepp 11y agoAt work, we migrated a small codebase this year to VS2008. It was "painful". This week I put it through asan and found five buffer overflows or similar with about a half hour of work, but the thing still spits out a hundred warnings or so when you compile, and that's with default settings. This project is about 1% of the code, by line count, that my team is responsible for. At home, I turn on -Wall -Wextra for starters, enable about a dozen more for good measure, with -Werror as the pièce de réisistance.
- btrask 11y agoThe problem is UBSan is still kind of a pain to use. Just turn all of these optimizations directly into warnings and the problem would be solved--if you want to optimize them, the warnings will let you do it yourself.
- npsimons 11y ago> Everybody should build code at this level from day 1. On the project I run, the CI will reject your code in CR if it doesn't compile under two different compilers with all but a handful of warnings turned on as errors, runs and passes tests, and passes various linters, including a check for undocumented types, variables, parameters and return values. IMNSHO, every project should be like this. Once it's setup, it's a breeze and doesn't impede development speed at all.