4 ms·
LLVM is still in disagreement as to whether or not infinite loops are UB [1], and others. It is becoming more mature... But the argument about how to handle an
by shakna 7y ago
LLVM is still in disagreement as to whether or not infinite loops are UB [1], and others.
It is becoming more mature... But the argument about how to handle an empty infinite loop has been going on since 2015.
[1] https://bugs.llvm.org/show_bug.cgi?id=24078 https://bugs.llvm.org/show_bug.cgi?id=24078
- Gibbon1 7y agoOffhand 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.