diff options
author | Petr Pavlu <petr.pavlu@arm.com> | 2018-10-04 09:25:44 +0000 |
---|---|---|
committer | Petr Pavlu <petr.pavlu@arm.com> | 2018-10-04 09:25:44 +0000 |
commit | ed083f2c1f56c0a79d38a0d4f7c4232eba641fdf (patch) | |
tree | e3c1fcce944de33718a193d691f284d342222e69 /clang/lib | |
parent | d9eae3980023e771aa0063089077e10b4b4d6cad (diff) | |
download | bcm5719-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')
-rw-r--r-- | clang/lib/AST/ExprConstant.cpp | 4 |
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; |