2 ms·
Unfortunately it's a theoretical impossibility to detect all instances of UB in a static-analysis. Rice's theorem strikes again. These days we have pretty good
by MaxBarraclough 8y ago
Unfortunately it's a theoretical impossibility to detect all instances of UB in a static-analysis. Rice's theorem strikes again.
These days we have pretty good static analysis tools, and tools like UBSan which can insert certain checks at runtime. Not perfect though.
I believe it's possible to approach it from the other side though: use MISRA C, a terribly strict C programming ruleset, which I believe can be mechanically verified, and which avoids any possible UB. (This is an 'overly strict' approach, as it forbids doing certain perfectly legal things.)