2022-07-17 20:54:10 -05:00
|
|
|
//@ignore-target-windows: No libc on Windows
|
2021-12-06 15:15:02 -06:00
|
|
|
#![feature(rustc_private)]
|
|
|
|
|
|
|
|
/// Test that destroying a pthread_cond twice fails, even without a check for number validity
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
unsafe {
|
|
|
|
use core::mem::MaybeUninit;
|
|
|
|
let mut attr = MaybeUninit::<libc::pthread_condattr_t>::uninit();
|
|
|
|
libc::pthread_condattr_init(attr.as_mut_ptr());
|
|
|
|
|
|
|
|
let mut cond = MaybeUninit::<libc::pthread_cond_t>::uninit();
|
|
|
|
|
|
|
|
libc::pthread_cond_init(cond.as_mut_ptr(), attr.as_ptr());
|
|
|
|
|
|
|
|
libc::pthread_cond_destroy(cond.as_mut_ptr());
|
|
|
|
|
|
|
|
libc::pthread_cond_destroy(cond.as_mut_ptr());
|
2022-07-11 06:44:55 -05:00
|
|
|
//~^ ERROR: Undefined Behavior: using uninitialized data, but this operation requires initialized memory
|
2021-12-06 15:15:02 -06:00
|
|
|
}
|
|
|
|
}
|