Fix run-pass/signal-exit-status to not trigger UB by writing to NULL.

This commit is contained in:
Eduard Burtescu 2016-08-30 05:34:21 +03:00
parent 77d2cd28fd
commit 8341f6451b

View File

@ -18,7 +18,7 @@ pub fn main() {
let args: Vec<String> = env::args().collect();
if args.len() >= 2 && args[1] == "signal" {
// Raise a segfault.
unsafe { *(0 as *mut isize) = 0; }
unsafe { *(1 as *mut isize) = 0; }
} else {
let status = Command::new(&args[0]).arg("signal").status().unwrap();
assert!(status.code().is_none());