https://llvm.org/bugs/show_bug.cgi?id=27581
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: unassignedclangb...@nondot.org Reporter: nlewy...@google.com CC: llvm-bugs@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) { ptr->method(); (*ptr).method(); intasptr(&ptr->i); ptr->i++; } void X::nocheck(X &ref) { ref.method(); // has extra check method(); // has extra check intasptr(&ref.i); intasptr(&i); // has extra check ref.i++; i++; // has extra check intasptr(&getref()); } 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.
_______________________________________________ llvm-bugs mailing list llvm-bugs@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs