llvmc: report an error if a child process segfaults.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@104145 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CompilerDriver/Action.cpp b/lib/CompilerDriver/Action.cpp
index 9d07811..8c63a4d 100644
--- a/lib/CompilerDriver/Action.cpp
+++ b/lib/CompilerDriver/Action.cpp
@@ -67,7 +67,20 @@
     argv.push_back(0);  // null terminate list.
 
     // Invoke the program.
-    return sys::Program::ExecuteAndWait(prog, &argv[0], 0, &redirects[0]);
+    int ret = sys::Program::ExecuteAndWait(prog, &argv[0], 0, &redirects[0]);
+
+    if (ret < 0) {
+      const char** B = &argv[0];
+
+      errs() << "Segmentation fault:";
+      while (*B)
+        errs() << ' ' << *(B++);
+      errs() << '\n';
+
+      return 1;
+    }
+
+    return ret;
   }
 
   void print_string (const std::string& str) {