1
Fork 0

Merge commit 'e8dca3e87d' into sync_from_cg_gcc

This commit is contained in:
Antoni Boucher 2022-06-06 22:04:37 -04:00
commit 3fac982e07
41 changed files with 7933 additions and 592 deletions

View file

@ -1,7 +1,7 @@
// Compiler:
//
// Run-time:
// stdout: Panicking
// stdout: Success
// status: signal
#![allow(unused_attributes)]
@ -64,7 +64,9 @@ mod intrinsics {
#[no_mangle]
pub fn panic(_msg: &str) -> ! {
unsafe {
libc::puts("Panicking\0" as *const str as *const u8);
// Panicking is expected iff overflow checking is enabled.
#[cfg(debug_assertions)]
libc::puts("Success\0" as *const str as *const u8);
libc::fflush(libc::stdout);
intrinsics::abort();
}
@ -124,6 +126,15 @@ impl Add for isize {
#[start]
fn main(mut argc: isize, _argv: *const *const u8) -> isize {
let int = 9223372036854775807isize;
let int = int + argc;
let int = int + argc; // overflow
// If overflow checking is disabled, we should reach here.
#[cfg(not(debug_assertions))]
unsafe {
libc::puts("Success\0" as *const str as *const u8);
libc::fflush(libc::stdout);
intrinsics::abort();
}
int
}