1 // ignore-windows: Concurrency on Windows is not supported yet. 2 // compile-flags: -Zmiri-disable-abi-check 3 // error-pattern: unwinding past the topmost frame of the stack 4 5 //! Unwinding past the top frame of a stack is Undefined Behavior. 6 7 #![feature(rustc_private, c_unwind)] 8 9 extern crate libc; 10 11 use std::{mem, ptr}; 12 thread_start(_null: *mut libc::c_void) -> *mut libc::c_void13extern "C-unwind" fn thread_start(_null: *mut libc::c_void) -> *mut libc::c_void { 14 panic!() 15 } 16 main()17fn main() { 18 unsafe { 19 let mut native: libc::pthread_t = mem::zeroed(); 20 let attr: libc::pthread_attr_t = mem::zeroed(); 21 // assert_eq!(libc::pthread_attr_init(&mut attr), 0); FIXME: this function is not yet implemented. 22 // Cast to avoid inserting abort-on-unwind. 23 let thread_start: extern "C-unwind" fn(*mut libc::c_void) -> *mut libc::c_void = thread_start; 24 let thread_start: extern "C" fn(*mut libc::c_void) -> *mut libc::c_void = mem::transmute(thread_start); 25 assert_eq!(libc::pthread_create(&mut native, &attr, thread_start, ptr::null_mut()), 0); 26 assert_eq!(libc::pthread_join(native, ptr::null_mut()), 0); 27 } 28 } 29