Closed
Description
I'm not sure if this is a false positive, a codegen bug, or an LLVM bug.
fn main() { do spawn {} }
That will generate a warning in valgrind about a jump based on an uninitialized value.
I've simplified it to:
use std::util;
enum Option<T> {
None,
Some(T),
}
#[inline(never)]
fn function(slot: &mut Option<proc(proc()) -> proc()>, f: proc()) {
let a = util::replace(slot, None);
let a = match a {
Some(a) => bar(a, f),
None => f,
};
foo(a);
}
#[inline(never)]
fn bar(f: proc(proc()) -> proc(), g: proc()) -> proc() {
f(g)
}
#[inline(never)]
fn foo(_f: proc()) {
}
#[start]
fn main(_: int, _: **u8) -> int {
let mut slot = None;
function(&mut slot, proc() {});
0
}
I tried to make this test case have as little dependence on libstd as possible, but it didn't really help much with the output IR. The function function
is the one that has the valgrind warning inside it, but I can't quite figure out where.
The output assembly is https://gist.github.com/alexcrichton/8549277 and the suspicious instruction is 0x405235