Skip to content

Commit dad9547

Browse files
committed
test thread-local key with no dtor
1 parent 24a9a14 commit dad9547

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

src/terminator/mod.rs

-1
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,6 @@ impl<'a, 'tcx> EvalContext<'a, 'tcx> {
727727

728728
// Extract the function type out of the signature (that seems easier than constructing it ourselves...)
729729
let dtor_ptr = args[1].read_ptr(&self.memory)?;
730-
// TODO: The null-pointer case here is entirely untested
731730
let dtor = if dtor_ptr.is_null_ptr() { None } else { Some(self.memory.get_fn(dtor_ptr.alloc_id)?) };
732731

733732
// Figure out how large a pthread TLS key actually is. This is libc::pthread_key_t.
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#![feature(libc)]
2+
extern crate libc;
3+
4+
use std::mem;
5+
6+
pub type Key = libc::pthread_key_t;
7+
8+
pub unsafe fn create(dtor: Option<unsafe extern fn(*mut u8)>) -> Key {
9+
let mut key = 0;
10+
assert_eq!(libc::pthread_key_create(&mut key, mem::transmute(dtor)), 0);
11+
key
12+
}
13+
14+
fn main() {
15+
let _ = unsafe { create(None) };
16+
}

0 commit comments

Comments
 (0)