Skip to content

Commit f0277de

Browse files
committed
[CHERI] No need to preserve tags when copying from NULL constants
Looking at the commit history the only test that triggers this is specific to the MS C++ ABI, so I have not been able to create a testcase.
1 parent fcf95af commit f0277de

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

clang/lib/CodeGen/CGExprCXX.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -564,7 +564,8 @@ static void EmitNullBaseClassInitialization(CodeGenFunction &CGF,
564564
CGF.Builder.CreateMemCpy(
565565
CGF.Builder.CreateConstInBoundsByteGEP(DestPtr, StoreOffset),
566566
CGF.Builder.CreateConstInBoundsByteGEP(SrcPtr, StoreOffset),
567-
StoreSizeVal);
567+
StoreSizeVal, /* NULL constants never contain tags */
568+
llvm::PreserveCheriTags::Unnecessary);
568569
}
569570

570571
// Otherwise, just memset the whole thing to zero. This is legal

0 commit comments

Comments
 (0)