[PATCH] D81608: Fix incorrect call to ExprResult::get()

Alexander Richardson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jun 10 12:47:21 PDT 2020


arichardson created this revision.
arichardson added reviewers: Anastasia, pekka.jaaskelainen.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

Res is already a ExprResult, so if we call .get() we convert an
ExprError() result into an unset result. I discovered this in our
downstream CHERI target where this resulted in a crash due to a
NULL-dereference.
It appears that this was introduced in SVN revision 201788 (8690a6860a45ba36e39b4ff0dbe434195e125d11)


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D81608

Files:
  clang/lib/Sema/SemaExpr.cpp


Index: clang/lib/Sema/SemaExpr.cpp
===================================================================
--- clang/lib/Sema/SemaExpr.cpp
+++ clang/lib/Sema/SemaExpr.cpp
@@ -724,7 +724,7 @@
   // to function type.
   if (Ty->isFunctionType()) {
     Res = ImpCastExprToType(E, Context.getPointerType(Ty),
-                            CK_FunctionToPointerDecay).get();
+                            CK_FunctionToPointerDecay);
     if (Res.isInvalid())
       return ExprError();
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D81608.269946.patch
Type: text/x-patch
Size: 480 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200610/4300885c/attachment.bin>


More information about the cfe-commits mailing list