summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/ExprConstant.cpp
diff options
context:
space:
mode:
authorPetr Pavlu <petr.pavlu@arm.com>2018-10-04 09:25:44 +0000
committerPetr Pavlu <petr.pavlu@arm.com>2018-10-04 09:25:44 +0000
commited083f2c1f56c0a79d38a0d4f7c4232eba641fdf (patch)
treee3c1fcce944de33718a193d691f284d342222e69 /clang/lib/AST/ExprConstant.cpp
parentd9eae3980023e771aa0063089077e10b4b4d6cad (diff)
downloadbcm5719-llvm-ed083f2c1f56c0a79d38a0d4f7c4232eba641fdf.tar.gz
bcm5719-llvm-ed083f2c1f56c0a79d38a0d4f7c4232eba641fdf.zip
[constexpr] Fix ICE when memcpy() is given a pointer to an incomplete array
Fix code for constant evaluation of __builtin_memcpy() and __builtin_memmove() that would attempt to divide by zero when given two pointers to an incomplete array. Differential Revision: https://reviews.llvm.org/D51855 llvm-svn: 343761
Diffstat (limited to 'clang/lib/AST/ExprConstant.cpp')
-rw-r--r--clang/lib/AST/ExprConstant.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/AST/ExprConstant.cpp b/clang/lib/AST/ExprConstant.cpp
index a34940e53ad..c012fc377fb 100644
--- a/clang/lib/AST/ExprConstant.cpp
+++ b/clang/lib/AST/ExprConstant.cpp
@@ -6239,6 +6239,10 @@ bool PointerExprEvaluator::VisitBuiltinCallExpr(const CallExpr *E,
Info.FFDiag(E, diag::note_constexpr_memcpy_type_pun) << Move << SrcT << T;
return false;
}
+ if (T->isIncompleteType()) {
+ Info.FFDiag(E, diag::note_constexpr_memcpy_incomplete_type) << Move << T;
+ return false;
+ }
if (!T.isTriviallyCopyableType(Info.Ctx)) {
Info.FFDiag(E, diag::note_constexpr_memcpy_nontrivial) << Move << T;
return false;
OpenPOWER on IntegriCloud