3 ms·
Optimizing away even more calls of memset, memcpy or memmove is the completely wrong way. gcc went down this bug and called it "optimization", now llvm did the
by rurban 7y ago
Optimizing away even more calls of memset, memcpy or memmove is the completely wrong way. gcc went down this bug and called it "optimization", now llvm did the same. Can we at least keep at least one sane working compiler? At least emit a prominent warning when "optimizing" away lib calls. This helps only artificial benchmarks and will hurt everybody.
If an assignment to const memory is illegal, treat it as error, and don't silently remove it.
Fear we'll have to blacklist clang-9 also, not just gcc-9.
- mlindner 7y agoHow about you fix your code to not rely on undefined behavior specific to a compiler version? Poor coding standards is not an excuse.
- sanxiyn 7y ago> This helps only artificial benchmarks and will hurt everybody. Any source of this claim? As I understand, on SPEC 2006 lib call optimizations make 5% improvement with GCC, the least artificial benchmark among SPEC 2006.
- d33 7y agoI believe rurban might have some point - for example, consider this CCC talk: https://www.youtube.com/watch?v=0WzjAKABSDk https://www.youtube.com/watch?v=0WzjAKABSDk The point is that memset is often critical for security and compilers don't always do a good job of optimizing it out. If they strike a false positive, information leak vulnerabilities are very likely. It's also pretty difficult to detect those failures without recompiling entire program with a modified compiler, as shown in the talk.