[PATCH] D146466: [clang] diagnose function fallthrough

Nikita Popov via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 23 13:14:31 PDT 2023


nikic added a comment.

@nickdesaulniers I don't think we want to handle that on the LLVM side. That will be fundamentally unreliable. If Clang wishes to make "recoverable" ubsan have arbitrary but well-defined behavior in the case of UB, it needs to generate appropriate IR to model that. For example, instead of generating

  if (x == 0) {
    report_div_by_zero();
  }
  res = y / x;

it needs to generate

  if (x == 0) {
    report_div_by_zero();
    res = 0; // or any other value
  } else {
    res = y / x;
  }

And similarly for other cases.


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