git: b65d87e5d7b5 - stable/12 - Apply upstream clang fix for assertion failure compiling devel/capnproto

Dimitry Andric dim at FreeBSD.org
Sat Aug 21 15:14:43 UTC 2021


The branch stable/12 has been updated by dim:

URL: https://cgit.FreeBSD.org/src/commit/?id=b65d87e5d7b58fd06cf4a3061b564d62f1033999

commit b65d87e5d7b58fd06cf4a3061b564d62f1033999
Author:     Dimitry Andric <dim at FreeBSD.org>
AuthorDate: 2021-08-21 14:26:51 +0000
Commit:     Dimitry Andric <dim at FreeBSD.org>
CommitDate: 2021-08-21 15:13:37 +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/12, 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-branches mailing list