This revision was automatically updated to reflect the committed changes. Closed by commit rL305546: [ubsan] PR33081: Skip the standard type checks for volatile (authored by vedantk).
Changed prior to commit: https://reviews.llvm.org/D34262?vs=102758&id=102778#toc Repository: rL LLVM https://reviews.llvm.org/D34262 Files: cfe/trunk/lib/CodeGen/CGExpr.cpp cfe/trunk/test/CodeGen/ubsan-volatile.c Index: cfe/trunk/test/CodeGen/ubsan-volatile.c =================================================================== --- cfe/trunk/test/CodeGen/ubsan-volatile.c +++ cfe/trunk/test/CodeGen/ubsan-volatile.c @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsanitize=null,alignment,object-size,vptr -S -emit-llvm %s -o - | FileCheck %s + +// CHECK: @volatile_null_deref +void volatile_null_deref(volatile int *p) { + // CHECK-NOT: call{{.*}}ubsan + *p; +} Index: cfe/trunk/lib/CodeGen/CGExpr.cpp =================================================================== --- cfe/trunk/lib/CodeGen/CGExpr.cpp +++ cfe/trunk/lib/CodeGen/CGExpr.cpp @@ -549,6 +549,11 @@ if (Ptr->getType()->getPointerAddressSpace()) return; + // Don't check pointers to volatile data. The behavior here is implementation- + // defined. + if (Ty.isVolatileQualified()) + return; + SanitizerScope SanScope(this); SmallVector<std::pair<llvm::Value *, SanitizerMask>, 3> Checks;
Index: cfe/trunk/test/CodeGen/ubsan-volatile.c =================================================================== --- cfe/trunk/test/CodeGen/ubsan-volatile.c +++ cfe/trunk/test/CodeGen/ubsan-volatile.c @@ -0,0 +1,7 @@ +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fsanitize=null,alignment,object-size,vptr -S -emit-llvm %s -o - | FileCheck %s + +// CHECK: @volatile_null_deref +void volatile_null_deref(volatile int *p) { + // CHECK-NOT: call{{.*}}ubsan + *p; +} Index: cfe/trunk/lib/CodeGen/CGExpr.cpp =================================================================== --- cfe/trunk/lib/CodeGen/CGExpr.cpp +++ cfe/trunk/lib/CodeGen/CGExpr.cpp @@ -549,6 +549,11 @@ if (Ptr->getType()->getPointerAddressSpace()) return; + // Don't check pointers to volatile data. The behavior here is implementation- + // defined. + if (Ty.isVolatileQualified()) + return; + SanitizerScope SanScope(this); SmallVector<std::pair<llvm::Value *, SanitizerMask>, 3> Checks;
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits