2020-05-10 09:54:30 -05:00
|
|
|
// Compiler:
|
|
|
|
//
|
|
|
|
// Run-time:
|
2022-06-06 21:04:37 -05:00
|
|
|
// stdout: Success
|
2020-05-10 09:54:30 -05:00
|
|
|
// status: signal
|
|
|
|
|
2023-09-06 18:01:04 -05:00
|
|
|
fn main() {
|
|
|
|
std::panic::set_hook(Box::new(|_| {
|
|
|
|
println!("Success");
|
|
|
|
std::process::abort();
|
|
|
|
}));
|
2020-05-10 09:54:30 -05:00
|
|
|
|
2023-09-06 18:01:04 -05:00
|
|
|
let arg_count = std::env::args().count();
|
|
|
|
let int = isize::MAX;
|
|
|
|
let _int = int + arg_count as isize; // overflow
|
2022-06-06 21:04:37 -05:00
|
|
|
|
|
|
|
// If overflow checking is disabled, we should reach here.
|
|
|
|
#[cfg(not(debug_assertions))]
|
|
|
|
unsafe {
|
2023-09-06 18:01:04 -05:00
|
|
|
println!("Success");
|
|
|
|
std::process::abort();
|
2022-06-06 21:04:37 -05:00
|
|
|
}
|
2020-05-10 09:54:30 -05:00
|
|
|
}
|