3 ms·
If there were a simple and reliable way to say "make the program crash if we hit any of this UB, rather than optimising it completely away" I think that would m
by iainmerrick 9y ago
If there were a simple and reliable way to say "make the program crash if we hit any of this UB, rather than optimising it completely away" I think that would make a lot of people happy.
- pcwalton 9y agoLLVM already does this as much as possible. Look at how Clang inserts "ud2" instructions in dead code paths.
- iainmerrick 9y agoIs there a way to use that to address the "NeverCalled" example? I feel like there's a huge disconnect here. Even after the strange behavior is explained, some people say "wow, I never ever want that behavior, how do I reliably avoid it?" but others respond "there's no problem, you're just using it wrong". Is there really no way to satisfy both sides?