krasin added inline comments.

================
Comment at: test/ubsan/TestCases/TypeCheck/null.cpp:1
-// RUN: %clangxx -fsanitize=null %s -O3 -o %t
-// RUN: %run %t l 2>&1 | FileCheck %s --check-prefix=CHECK-LOAD
-// RUN: %expect_crash %run %t s 2>&1 | FileCheck %s --check-prefix=CHECK-STORE
-// RUN: %run %t r 2>&1 | FileCheck %s --check-prefix=CHECK-REFERENCE
-// RUN: %run %t m 2>&1 | FileCheck %s --check-prefix=CHECK-MEMBER
-// RUN: %run %t f 2>&1 | FileCheck %s --check-prefix=CHECK-MEMFUN
+// RUN: %clangxx -fsanitize=null -fno-sanitize-recover=null -g %s -O3 -o %t
+// RUN: not %run %t l 2>&1 | FileCheck %s --check-prefix=CHECK-LOAD
----------------
pcc wrote:
> Why add the -g?
It's a debug left over. Thank you for the catch.


================
Comment at: test/ubsan/TestCases/TypeCheck/null.cpp:10
+
+#include <stdio.h>
 
----------------
pcc wrote:
> Is this #include needed?
Debug leftover. Removed. Thank you for spotting this.


================
Comment at: test/ubsan/TestCases/TypeCheck/null.cpp:35
+
+  if (argv[1][0] == 'T') {
+    t = new T;
----------------
pcc wrote:
> Did you intend to add tests for these cases?
Actually, the real reason for adding these is that break_optimization didn't 
really fool the compiler, and I had to add some more logic to avoid letting it 
know that the pointer is always null => it's undefined behavior. In my case, I 
saw my return being ignored and two switch statements executed together.

I can't currently reproduce it now, most likely, because the fix has eliminated 
the virtual call on a pointer that is guaranteed to be null. So, I have removed 
these as well as break_optimization calls.



https://reviews.llvm.org/D26560



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to