[llvm-commits] CVS: llvm/lib/CWriter/Writer.cpp

Chris Lattner lattner at cs.uiuc.edu
Mon Sep 15 11:48:01 PDT 2003


Changes in directory llvm/lib/CWriter:

Writer.cpp updated: 1.125 -> 1.126

---
Log message:

Fix problems with programs that prototype printf to something unusual


---
Diffs of the changes:

Index: llvm/lib/CWriter/Writer.cpp
diff -u llvm/lib/CWriter/Writer.cpp:1.125 llvm/lib/CWriter/Writer.cpp:1.126
--- llvm/lib/CWriter/Writer.cpp:1.125	Thu Sep 11 17:33:18 2003
+++ llvm/lib/CWriter/Writer.cpp	Mon Sep 15 11:47:12 2003
@@ -987,8 +987,10 @@
   // instruction is found.  In this context, we code generated the invoke
   // instruction to add an entry to the top of the jmpbuf_list.  Thus, here we
   // just have to longjmp to the specified handler.
-  Out << "  if (__llvm_jmpbuf_list == 0) {  /* llvm.unwind */\n"
-      << "    printf(\"throw found with no handler!\\n\"); abort();\n"
+  Out << "  if (__llvm_jmpbuf_list == 0) {  /* unwind */\n"
+      << "    extern write();\n"
+      << "    ((void (*)(int, void*, unsigned))write)(2,\n"
+      << "           \"throw found with no handler!\\n\", 31); abort();\n"
       << "  }\n"
       << "  longjmp(__llvm_jmpbuf_list->buf, 1);\n";
   emittedInvoke = true;





More information about the llvm-commits mailing list