[PATCH] D34262: [ubsan] PR33081: Skip the standard type checks for volatile

Phabricator via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 15 20:28:24 PDT 2017


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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D34262.102778.patch
Type: text/x-patch
Size: 986 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170616/3cce8e7d/attachment.bin>


More information about the cfe-commits mailing list