[PATCH] D96418: [clang] Refactor mustprogress handling, add it to all loops in c++11+.

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 26 19:33:32 PDT 2021


rjmccall added a comment.

There's no reliable way to report this with UBSan because in general we can't ever know that a loop will not terminate.  That said, we could report *obviously* trivial loops, either with UBSan or just with a diagnostic.  If the body of your loop really is empty, and the conditions are trivial, that ought to be enough to catch it.

The conformant fix is to do some sort of atomic operation or other side-effect in your loop; the non-conformant fix is to disable the optimization with `-fno-finite-loops`.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D96418



More information about the cfe-commits mailing list