rjmansfield wrote:

> We built the Clang compiler with this patch on a macOS system, and the listed 
> test cases passed for us.
> 
> The Clang compiler not containing this patch would fail the updated test 
> cases because its exit code does not indicate termination by a signal.

@xingxue-ibm  I believe the issue being observed on macOS is that the stage2 
compiler is being built with `CLANG_SPAWN_CC1=ON`.  I can also reproduce the 
testfailure by forcing `-fno-integrated-cc1 `  in the test cases.   I imagine 
this could be reproduced on other LLVM_ON_UNIX similarly. It appears when the 
child cc1 process crashes, sys::ExecuteAndWait returns -2, but  the new 
resignaling code  tests for > 128 so it is never executed so the driver exits 
cleanly with code 1.

```
The resignalling code looks like it needs:
diff --git a/llvm/lib/Support/Unix/Program.inc 
b/llvm/lib/Support/Unix/Program.inc
index 489ca03b3067..f4ed66a636b6 100644
--- a/llvm/lib/Support/Unix/Program.inc
+++ b/llvm/lib/Support/Unix/Program.inc
@@ -494,9 +494,7 @@ ProcessInfo llvm::sys::Wait(const ProcessInfo &PI,
         *ErrMsg += " (core dumped)";
 #endif
     }
-    // Return a special value to indicate that the process received an 
unhandled
-    // signal during execution as opposed to failing to execute.
-    WaitResult.ReturnCode = -2;
+    WaitResult.ReturnCode = 128 + WTERMSIG(status);
   }
   return WaitResult;
 }
```

https://github.com/llvm/llvm-project/pull/169340
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to