[llvm-bugs] [Bug 27581] New: null sanitizer emits too many checks

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Apr 29 17:44:11 PDT 2016


            Bug ID: 27581
           Summary: null sanitizer emits too many checks
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: nlewycky at google.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Testcase for things that should have checks with -fsanitize=null and things
that should not:

struct X {
  void nocheck(X &);
  void method();
  int i;
int &getref();
void intasptr(int *);

void check(X *ptr) {

void X::nocheck(X &ref) {
  ref.method();  // has extra check
  method();  // has extra check
  intasptr(&i);  // has extra check
  i++;  // has extra check


The checks commented as being extra are ones which would have been caught by
-fsanitize=null when attempting to construct this situation, therefore they
would lead to duplicate error emission. Fixing these is desirable to reduce the
compile time and code size impact of the null sanitizer.

There's one other case I didn't list, "(&ref)->method();" which has an extra
check. That could go either way really, it happens to be impossible to be null
but that could be emitted by the sanitizer and left to the optimizer, or if
clang finds it easy enough to locally show that it's non-null, that works too.

You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160430/d907b281/attachment.html>

More information about the llvm-bugs mailing list