From 020cddcfee9cdec09b281fe439bc1ec0c570238e Mon Sep 17 00:00:00 2001 From: Sebastian Redl Date: Fri, 9 Jan 2009 21:09:38 +0000 Subject: [PATCH] Prevent a segfault for vaarg expressions on unsupported architectures. llvm-svn: 62008 --- clang/lib/CodeGen/CGExprAgg.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/clang/lib/CodeGen/CGExprAgg.cpp b/clang/lib/CodeGen/CGExprAgg.cpp index 834d7483bafe..7571149b5a7c 100644 --- a/clang/lib/CodeGen/CGExprAgg.cpp +++ b/clang/lib/CodeGen/CGExprAgg.cpp @@ -278,9 +278,11 @@ void AggExprEmitter::VisitVAArgExpr(VAArgExpr *VE) { llvm::Value *ArgValue = CGF.EmitLValue(VE->getSubExpr()).getAddress(); llvm::Value *ArgPtr = CGF.EmitVAArg(ArgValue, VE->getType()); - if (!ArgPtr) + if (!ArgPtr) { CGF.ErrorUnsupported(VE, "aggregate va_arg expression"); - + return; + } + if (DestPtr) // FIXME: volatility CGF.EmitAggregateCopy(DestPtr, ArgPtr, VE->getType());