From f8e6f4f776cbe65d62528adbf961a10cbf129fc3 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Tue, 10 Aug 2004 00:19:16 +0000 Subject: [PATCH] Paper over CBackend/2004-08-09-va-end-null.ll Note that this indicates a serious problem with the way we are emitting varargs, but this should not be properly fixed until after 1.3. This patch SHOULD go into 1.3. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@15602 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/CBackend/CBackend.cpp | 10 +++++++--- lib/Target/CBackend/Writer.cpp | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp index 65a110e567e..bb1548f8a8c 100644 --- a/lib/Target/CBackend/CBackend.cpp +++ b/lib/Target/CBackend/CBackend.cpp @@ -1390,9 +1390,13 @@ void CWriter::visitCallInst(CallInst &I) { Out << ")"; return; case Intrinsic::vaend: - Out << "va_end(*(va_list*)&"; - writeOperand(I.getOperand(1)); - Out << ")"; + if (!isa(I.getOperand(1))) { + Out << "va_end(*(va_list*)&"; + writeOperand(I.getOperand(1)); + Out << ")"; + } else { + Out << "va_end(*(va_list*)0)"; + } return; case Intrinsic::vacopy: Out << "0;"; diff --git a/lib/Target/CBackend/Writer.cpp b/lib/Target/CBackend/Writer.cpp index 65a110e567e..bb1548f8a8c 100644 --- a/lib/Target/CBackend/Writer.cpp +++ b/lib/Target/CBackend/Writer.cpp @@ -1390,9 +1390,13 @@ void CWriter::visitCallInst(CallInst &I) { Out << ")"; return; case Intrinsic::vaend: - Out << "va_end(*(va_list*)&"; - writeOperand(I.getOperand(1)); - Out << ")"; + if (!isa(I.getOperand(1))) { + Out << "va_end(*(va_list*)&"; + writeOperand(I.getOperand(1)); + Out << ")"; + } else { + Out << "va_end(*(va_list*)0)"; + } return; case Intrinsic::vacopy: Out << "0;";