[PATCH] D146466: [clang] diagnose function fallthrough

Eli Friedman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 23 15:52:06 PDT 2023


efriedma added a comment.

I think the reason "recoverable" ubsan causes trouble is that it introduces branches that subsequent optimizations can abuse.  So without ubsan, we just have an udiv instruction.  With ubsan, we conveniently have a branch on exactly the condition that would make the udiv undefined, so we can easily prove control flow doesn't continue after the ubsan handler.  Subsequent optimizations take advantage of that, so ubsan "breaks" code.  (So the code was never actually correct according to the semantic model, but it was broken in a way the compiler is less likely optimize.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D146466/new/

https://reviews.llvm.org/D146466



More information about the cfe-commits mailing list