Modern compilers&#x2F;analyzers can and will report whatever statically detectable UB they can, but most interesting cases are triggered dynamically. e.g.:<p><pre><code>    int data[64];

    int foo(int bar) {
       return data[bar];
    }
</code></pre>
If foo() has external linkage, how does the compiler ensure it&#x27;s never called with a value &lt;0 or &gt;63?<p>And that&#x27;s an easy case.<p>clang&#x2F;llvm can instrument code to detect some forms of UB and trigger a diagnostic at runtime, but these checks can be expensive (and you still have a runtime failure, rather than a compile time detection).