[PATCH] D49492: Run bounds checking sanitizer earlier to make it easier to optimize away its checks.

Eli Friedman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jul 18 14:41:03 PDT 2018


efriedma added a comment.

This sanitizer has a bit of a strange design compared to other sanitizers; it tries to compute the size of the base object using the IR at the point the pass runs.  So the later it runs, the more information it has.  Trivial example:

  static int accumulate(int* foo, int n) {
    int sum = 0;
    for (unsigned i = 0; i < n; i++)
      sum += foo[i];
    return sum;
  }
  extern void fill(int *arr, int n);
  int dosum(int n) {
    int foo[1000];
    fill(foo, n);
    return accumulate(foo, n);
  }


Repository:
  rC Clang

https://reviews.llvm.org/D49492





More information about the cfe-commits mailing list