Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 31 May 2022 15:55:48 GMT
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 42e66f29f5b2 - stable/12 - Apply clang fix for assertion failure building webkit2-gtk
Message-ID:  <202205311555.24VFtmUc015534@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/12 has been updated by dim:

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

commit 42e66f29f5b24297366c60ea5d0c6e3537dd2f21
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2022-05-27 17:43:39 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2022-05-31 13:16:40 +0000

    Apply clang fix for assertion failure building webkit2-gtk
    
    Merge commit 30baa5d2a450 from llvm git (by Richard Smith):
    
      PR45879: Fix assert when constant evaluating union assignment.
    
      Consider the form of the first operand of a class assignment not the
      second operand when implicitly starting the lifetimes of union members.
      Also add a missing check that the assignment call actually came from a
      syntactic assignment, not from a direct call to `operator=`.
    
    PR:             264280
    Reported by:    bapt
    MFC after:      3 days
    
    (cherry picked from commit eca6e0f7e460bf9a4a6e1bd5198d75168280c88e)
---
 contrib/llvm-project/clang/lib/AST/ExprConstant.cpp | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/contrib/llvm-project/clang/lib/AST/ExprConstant.cpp b/contrib/llvm-project/clang/lib/AST/ExprConstant.cpp
index ba2865d66e0a..8cdef3c3fa04 100644
--- a/contrib/llvm-project/clang/lib/AST/ExprConstant.cpp
+++ b/contrib/llvm-project/clang/lib/AST/ExprConstant.cpp
@@ -6097,9 +6097,6 @@ static bool HandleFunctionCall(SourceLocation CallLoc,
     if (!handleTrivialCopy(Info, MD->getParamDecl(0), Args[0], RHSValue,
                            MD->getParent()->isUnion()))
       return false;
-    if (Info.getLangOpts().CPlusPlus20 && MD->isTrivial() &&
-        !HandleUnionActiveMemberChange(Info, Args[0], *This))
-      return false;
     if (!handleAssignment(Info, Args[0], *This, MD->getThisType(),
                           RHSValue))
       return false;
@@ -7611,6 +7608,15 @@ public:
         if (!EvaluateObjectArgument(Info, Args[0], ThisVal))
           return false;
         This = &ThisVal;
+
+        // If this is syntactically a simple assignment using a trivial
+        // assignment operator, start the lifetimes of union members as needed,
+        // per C++20 [class.union]5.
+        if (Info.getLangOpts().CPlusPlus20 && OCE &&
+            OCE->getOperator() == OO_Equal && MD->isTrivial() &&
+            !HandleUnionActiveMemberChange(Info, Args[0], ThisVal))
+          return false;
+
         Args = Args.slice(1);
       } else if (MD && MD->isLambdaStaticInvoker()) {
         // Map the static invoker for the lambda back to the call operator.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202205311555.24VFtmUc015534>