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, 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; +}