From: Timm Bäder Date: Sat, 7 Jan 2023 07:10:48 +0000 (+0100) Subject: [clang][Interp][NFCI] Don't crash on void builtin functions X-Git-Tag: upstream/17.0.6~19547 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=5bf56a58775cb235b7ed9e9fcc6895b797e9721b;p=platform%2Fupstream%2Fllvm.git [clang][Interp][NFCI] Don't crash on void builtin functions classifyPrim() runs into a llvm_unreachable() for those. --- diff --git a/clang/lib/AST/Interp/ByteCodeExprGen.cpp b/clang/lib/AST/Interp/ByteCodeExprGen.cpp index aaab980ac81b..316ba6356436 100644 --- a/clang/lib/AST/Interp/ByteCodeExprGen.cpp +++ b/clang/lib/AST/Interp/ByteCodeExprGen.cpp @@ -1479,10 +1479,9 @@ bool ByteCodeExprGen::VisitBuiltinCallExpr(const CallExpr *E) { if (!this->emitCallBI(Func, E)) return false; - if (DiscardResult) { - QualType ReturnType = E->getCallReturnType(Ctx.getASTContext()); + QualType ReturnType = E->getCallReturnType(Ctx.getASTContext()); + if (DiscardResult && !ReturnType->isVoidType()) { PrimType T = classifyPrim(ReturnType); - return this->emitPop(T, E); }