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(); }
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(); }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits