summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGExpr.cpp
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2017-06-16 03:27:36 +0000
committerVedant Kumar <vsk@apple.com>2017-06-16 03:27:36 +0000
commitc420d14b29e991b234e1ac3ad5f8d00abd0ed1dc (patch)
tree4ae95871985360ab2176a3098778bec2130d9b04 /clang/lib/CodeGen/CGExpr.cpp
parent10bbc4f99eda44d96df29bba74b6a0d6cc226113 (diff)
downloadbcm5719-llvm-c420d14b29e991b234e1ac3ad5f8d00abd0ed1dc.tar.gz
bcm5719-llvm-c420d14b29e991b234e1ac3ad5f8d00abd0ed1dc.zip
[ubsan] PR33081: Skip the standard type checks for volatile
Skip checks for null dereference, alignment violation, object size violation, and dynamic type violation if the pointer points to volatile data. Differential Revision: https://reviews.llvm.org/D34262 llvm-svn: 305546
Diffstat (limited to 'clang/lib/CodeGen/CGExpr.cpp')
-rw-r--r--clang/lib/CodeGen/CGExpr.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGExpr.cpp b/clang/lib/CodeGen/CGExpr.cpp
index 15829888ead..7359006677f 100644
--- a/clang/lib/CodeGen/CGExpr.cpp
+++ b/clang/lib/CodeGen/CGExpr.cpp
@@ -549,6 +549,11 @@ void CodeGenFunction::EmitTypeCheck(TypeCheckKind TCK, SourceLocation Loc,
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;
OpenPOWER on IntegriCloud