diff --git a/clang/lib/AST/APValue.cpp b/clang/lib/AST/APValue.cpp index 5b340e6e85bd79..c18f8854dc2b67 100644 --- a/clang/lib/AST/APValue.cpp +++ b/clang/lib/AST/APValue.cpp @@ -952,8 +952,10 @@ void APValue::setLValue(LValueBase B, const CharUnits &O, bool IsNullPtr) { MutableArrayRef InternalPath = setLValueUninit(B, O, Path.size(), IsOnePastTheEnd, IsNullPtr); - memcpy(InternalPath.data(), Path.data(), - Path.size() * sizeof(LValuePathEntry)); + if (Path.size()) { + memcpy(InternalPath.data(), Path.data(), + Path.size() * sizeof(LValuePathEntry)); + } } void APValue::setUnion(const FieldDecl *Field, const APValue &Value) {