Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 8 Jul 2020 16:50:47 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r363013 - head/contrib/llvm-project/clang/lib/Sema
Message-ID:  <202007081650.068GolhP078184@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Wed Jul  8 16:50:47 2020
New Revision: 363013
URL: https://svnweb.freebsd.org/changeset/base/363013

Log:
  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@digiware.nl>, eserte12@yahoo.de
  PR:		245530, 247812
  MFC after:	3 days

Modified:
  head/contrib/llvm-project/clang/lib/Sema/SemaExprCXX.cpp
  head/contrib/llvm-project/clang/lib/Sema/SemaOverload.cpp

Modified: head/contrib/llvm-project/clang/lib/Sema/SemaExprCXX.cpp
==============================================================================
--- head/contrib/llvm-project/clang/lib/Sema/SemaExprCXX.cpp	Wed Jul  8 16:23:40 2020	(r363012)
+++ head/contrib/llvm-project/clang/lib/Sema/SemaExprCXX.cpp	Wed Jul  8 16:50:47 2020	(r363013)
@@ -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: head/contrib/llvm-project/clang/lib/Sema/SemaOverload.cpp
==============================================================================
--- head/contrib/llvm-project/clang/lib/Sema/SemaOverload.cpp	Wed Jul  8 16:23:40 2020	(r363012)
+++ head/contrib/llvm-project/clang/lib/Sema/SemaOverload.cpp	Wed Jul  8 16:50:47 2020	(r363013)
@@ -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);



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