4 ms·
Offhand thought of the day. The Motor Industry Software Reliability Association should ban compilers that allow optimization based in UB. Because seriously the
by Gibbon1 7y ago
Offhand thought of the day. The Motor Industry Software Reliability Association should ban compilers that allow optimization based in UB.
Because seriously these people need to be stopped.
- astrange 7y agoUB was invented for the purpose of optimizing. No UB, no optimizing. And nobody is interested in funding or working on compilers that don't optimize. Anyway, just test with ubsan and you'll be good.
- dodobirdlord 7y agoAt least a lot of it was due to having to specify around the weird quirks of existing compiler implementations. C has far more undefined behavior than it needs for optimization, and modern programming language theory and compiler research has shown that most undefined behavior isn't really necessary at all. [0] For example, safe Rust has extremely close (and sometimes superior) performance to C, and has almost* no undefined behavior at all. [1] [0] https://www.cs.utah.edu/~regehr/papers/undef-pldi17.pdf https://www.cs.utah.edu/~regehr/papers/undef-pldi17.pdf [1] https://benchmarksgame-team.pages.debian.net/benchmarksgame/fastest/gcc-rust.html https://benchmarksgame-team.pages.debian.net/benchmarksgame/... * Some is inherited from LLVM, some is bugs, some is dumb corner cases like using kernel syscalls to overwrite the program's own memory with random bits.
- pingyong 7y agoName one example where UB is necessary for useful optimizations where simply having unspecified values or platform dependent behavior wouldn't be enough.