In a past life, I depended on signed overflow to detect out of bounds memory allocations. That kind of stuff gets compiled away these days, you need to be cleverer to detect when the user is deliberately trying to invoke UB. And because the compiler doesn't believe in UB, there's the risk it's going to remove your detection logic.
IIRC C++ just decided that signed numbers are two's complement and that's that. C could really use similar thing.
Signed integer overflow is still undefined in C++.
Quoting from the abstract of that talk: "... preserving source-level dependencies through to the generated CPU instructions is achieved through a delicate balance of volatile casts, magic compiler flags and sheer luck. Wouldn't it be nice if we could do better?"
In my years of working with C its always the 'look how smart I am code' causes issues.
Keep it clean and simple. Avoid complexity and fluff features of C. And you will not going to have deal with exotic bugs.
Why would you not actively avoid undefined behaviour and instead take risk.
Zeroing out variables, checking pointers coming from external modules etc. Not rallying on a compiler to resolve fancy stuff.
Like the example:
void contains_null_check(int P) { int dead = P; if (P == 0) return; P = 4; }
Leave declarations uninitialized or zeroed Check input. Work with data.
void contains_null_check(int P) { int dead; if (P == 0) return; int dead = P //work P = 4; }
This leaves less space for error/interpretation and IMHO it keeps code cleaner.
Any fancy optimizations should be used only for critical path and only when absolutely necessary.