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;";