git: d5c7f929b50d - stable/11 - Apply upstream clang fix for assertion failure compiling devel/capnproto
Dimitry Andric
dim at FreeBSD.org
Sat Aug 21 15:15:07 UTC 2021
The branch stable/11 has been updated by dim:
URL: https://cgit.FreeBSD.org/src/commit/?id=d5c7f929b50dbd5965c500ab42c93d0a2736ef99
commit d5c7f929b50dbd5965c500ab42c93d0a2736ef99
Author: Dimitry Andric <dim at FreeBSD.org>
AuthorDate: 2021-08-21 15:13:10 +0000
Commit: Dimitry Andric <dim at FreeBSD.org>
CommitDate: 2021-08-21 15:14:00 +0000
Apply upstream clang fix for assertion failure compiling devel/capnproto
Merge commit 48c70c1664aa from llvm git (by Richard Smith):
Extend memset-to-zero optimization to C++11 aggregate functional casts
Aggr{...}.
We previously missed these cases due to not stepping over the additional
AST nodes representing their syntactic form.
Direct commit to stable/11, as both main and stable/13 already have this
fix as part of clang 12.0.1.
Reported by: fernape
PR: 257961
---
contrib/llvm-project/clang/lib/CodeGen/CGExprAgg.cpp | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/contrib/llvm-project/clang/lib/CodeGen/CGExprAgg.cpp b/contrib/llvm-project/clang/lib/CodeGen/CGExprAgg.cpp
index 53dbfecfc538..658f0778796b 100644
--- a/contrib/llvm-project/clang/lib/CodeGen/CGExprAgg.cpp
+++ b/contrib/llvm-project/clang/lib/CodeGen/CGExprAgg.cpp
@@ -1732,7 +1732,9 @@ void AggExprEmitter::VisitDesignatedInitUpdateExpr(DesignatedInitUpdateExpr *E)
/// non-zero bytes that will be stored when outputting the initializer for the
/// specified initializer expression.
static CharUnits GetNumNonZeroBytesInInit(const Expr *E, CodeGenFunction &CGF) {
- E = E->IgnoreParens();
+ if (auto *MTE = dyn_cast<MaterializeTemporaryExpr>(E))
+ E = MTE->getSubExpr();
+ E = E->IgnoreParenNoopCasts(CGF.getContext());
// 0 and 0.0 won't require any non-zero stores!
if (isSimpleZero(E, CGF)) return CharUnits::Zero();
@@ -1781,7 +1783,7 @@ static CharUnits GetNumNonZeroBytesInInit(const Expr *E, CodeGenFunction &CGF) {
}
}
-
+ // FIXME: This overestimates the number of non-zero bytes for bit-fields.
CharUnits NumNonZeroBytes = CharUnits::Zero();
for (unsigned i = 0, e = ILE->getNumInits(); i != e; ++i)
NumNonZeroBytes += GetNumNonZeroBytesInInit(ILE->getInit(i), CGF);
More information about the dev-commits-src-all
mailing list