svn commit: r363092 - in stable: 11/contrib/llvm-project/clang/lib/Sema 12/contrib/llvm-project/clang/lib/Sema

Dimitry Andric dim at FreeBSD.org
Sat Jul 11 09:43:17 UTC 2020


Author: dim
Date: Sat Jul 11 09:43:16 2020
New Revision: 363092
URL: https://svnweb.freebsd.org/changeset/base/363092

Log:
  MFC r363013:
  
  Merge commit 065fc1eafe7c from llvm git (by Richard Smith):
  
    PR45521: Preserve the value kind when performing a standard
    conversion sequence on a glvalue expression.
  
    If the sequence is supposed to perform an lvalue-to-rvalue
    conversion, then one will be specified as the first conversion in the
    sequence. Otherwise, one should not be invented.
  
  This should fix clang crashing with "can't implicitly cast lvalue to
  rvalue with this cast kind", followed by "UNREACHABLE executed at
  /usr/src/contrib/llvm-project/clang/lib/Sema/Sema.cpp:538!", when
  building recent versions of Ceph, and the CPAN module SYBER/Date-5.2.0.
  
  Reported by:	Willem Jan Withagen <wjw at digiware.nl>, eserte12 at yahoo.de
  PR:		245530, 247812

Modified:
  stable/12/contrib/llvm-project/clang/lib/Sema/SemaExprCXX.cpp
  stable/12/contrib/llvm-project/clang/lib/Sema/SemaOverload.cpp
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/contrib/llvm-project/clang/lib/Sema/SemaExprCXX.cpp
  stable/11/contrib/llvm-project/clang/lib/Sema/SemaOverload.cpp
Directory Properties:
  stable/11/   (props changed)
  stable/11/contrib/llvm-project/clang/   (props changed)

Modified: stable/12/contrib/llvm-project/clang/lib/Sema/SemaExprCXX.cpp
==============================================================================
--- stable/12/contrib/llvm-project/clang/lib/Sema/SemaExprCXX.cpp	Sat Jul 11 07:33:18 2020	(r363091)
+++ stable/12/contrib/llvm-project/clang/lib/Sema/SemaExprCXX.cpp	Sat Jul 11 09:43:16 2020	(r363092)
@@ -4063,8 +4063,8 @@ Sema::PerformImplicitConversion(Expr *From, QualType T
     break;
 
   case ICK_Compatible_Conversion:
-      From = ImpCastExprToType(From, ToType, CK_NoOp,
-                               VK_RValue, /*BasePath=*/nullptr, CCK).get();
+    From = ImpCastExprToType(From, ToType, CK_NoOp, From->getValueKind(),
+                             /*BasePath=*/nullptr, CCK).get();
     break;
 
   case ICK_Writeback_Conversion:
@@ -4303,11 +4303,7 @@ Sema::PerformImplicitConversion(Expr *From, QualType T
     break;
 
   case ICK_Qualification: {
-    // The qualification keeps the category of the inner expression, unless the
-    // target type isn't a reference.
-    ExprValueKind VK =
-        ToType->isReferenceType() ? From->getValueKind() : VK_RValue;
-
+    ExprValueKind VK = From->getValueKind();
     CastKind CK = CK_NoOp;
 
     if (ToType->isReferenceType() &&

Modified: stable/12/contrib/llvm-project/clang/lib/Sema/SemaOverload.cpp
==============================================================================
--- stable/12/contrib/llvm-project/clang/lib/Sema/SemaOverload.cpp	Sat Jul 11 07:33:18 2020	(r363091)
+++ stable/12/contrib/llvm-project/clang/lib/Sema/SemaOverload.cpp	Sat Jul 11 09:43:16 2020	(r363092)
@@ -4693,7 +4693,7 @@ TryReferenceInit(Sema &S, Expr *Init, QualType DeclTyp
                               Sema::ReferenceConversions::NestedQualification)
                              ? ICK_Qualification
                              : ICK_Identity;
-    ICS.Standard.FromTypePtr = T2.getAsOpaquePtr();
+    ICS.Standard.setFromType(T2);
     ICS.Standard.setToType(0, T2);
     ICS.Standard.setToType(1, T1);
     ICS.Standard.setToType(2, T1);


More information about the svn-src-all mailing list