-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
From the thesis paper:
Nonetheless, there may still be programs that only result in a difference with the fast dump_var, but the bug disappears when it is tested again with the debug dump_var. In this case, we still have a reproduction and are still able to investigate the miscompilation, only more difficult
Have you considered merging the two dumper functions? Something like this:
#[inline(never)]
fn dump_var(
val0: impl Hash + Debug,
val1: impl Hash + Debug,
val2: impl Hash + Debug,
val3: impl Hash + Debug,
) {
if some_global_variable == DEBUG_MODE {
println!("fn{f}:_{var0} = {val0:?}\n_{var1} = {val1:?}\n_{var2} = {val2:?}\n_{var3} = {val3:?}");
}
else {
unsafe {
val0.hash(&mut H);
val1.hash(&mut H);
val2.hash(&mut H);
val3.hash(&mut H);
}
}
}The global variable would be set in main at runtime. Since the programs are guaranteed to be deterministic, you're guaranteed to get the same bugs for both branches. Since dump_var is already marked as #[inline(never)], the compiler would never optimize the checks away. The cost would be an additional always-predicted branch, which doesn't sound too bad.
Metadata
Metadata
Assignees
Labels
No labels