aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2003-10-23 18:39:22 +0000
committerChris Lattner <sabre@nondot.org>2003-10-23 18:39:22 +0000
commit4065ef99f91f929e4e0305cbd22b44873bbe66ab (patch)
tree8fedf89cbfe803601fc5589321db715bf4f9a030
parenteaa35bb794fc45df83fef6eada35783739a4030f (diff)
Fail gracefully if we have a zero arg varargs function
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9436 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/CBackend/CBackend.cpp6
-rw-r--r--lib/Target/CBackend/Writer.cpp6
2 files changed, 12 insertions, 0 deletions
diff --git a/lib/Target/CBackend/CBackend.cpp b/lib/Target/CBackend/CBackend.cpp
index f65d3d322e..b1f8793d64 100644
--- a/lib/Target/CBackend/CBackend.cpp
+++ b/lib/Target/CBackend/CBackend.cpp
@@ -1193,6 +1193,12 @@ void CWriter::visitCallInst(CallInst &I) {
Out << "va_start(*(va_list*)&" << Mang->getValueName(&I) << ", ";
// Output the last argument to the enclosing function...
+ if (I.getParent()->getParent()->aempty()) {
+ std::cerr << "The C backend does not currently support zero "
+ << "argument varargs functions, such as '"
+ << I.getParent()->getParent()->getName() << "'!\n";
+ abort();
+ }
writeOperand(&I.getParent()->getParent()->aback());
Out << ")";
return;
diff --git a/lib/Target/CBackend/Writer.cpp b/lib/Target/CBackend/Writer.cpp
index f65d3d322e..b1f8793d64 100644
--- a/lib/Target/CBackend/Writer.cpp
+++ b/lib/Target/CBackend/Writer.cpp
@@ -1193,6 +1193,12 @@ void CWriter::visitCallInst(CallInst &I) {
Out << "va_start(*(va_list*)&" << Mang->getValueName(&I) << ", ";
// Output the last argument to the enclosing function...
+ if (I.getParent()->getParent()->aempty()) {
+ std::cerr << "The C backend does not currently support zero "
+ << "argument varargs functions, such as '"
+ << I.getParent()->getParent()->getName() << "'!\n";
+ abort();
+ }
writeOperand(&I.getParent()->getParent()->aback());
Out << ")";
return;