void run_err_test_1()
{
auto b = vtil::basic_block::begin(0);
auto first = vtil::register_desc(vtil::register_flag::register_local, 0, 64);
auto second_ptr = vtil::register_desc(vtil::register_flag::register_local, 5, 64);
auto second = vtil::register_desc(vtil::register_flag::register_local, 4, 64);
auto result = vtil::register_desc(vtil::register_flag::register_local, 6, 64);
auto dest = vtil::register_desc(vtil::register_flag::register_local, 37, 64);
// load first value
b->ldd(first, X86_REG_R11, 0x0);
// load second value
b->mov(second_ptr, X86_REG_R11);
b->add(second_ptr, 0x8);
b->ldd(second, second_ptr, 0x0);
// calculate the result
b->mov(result, first);
b->add(result, second);
// store the result
b->mov(dest, X86_REG_R11);
b->add(dest, 0x8);
b->str(dest, 0x0, result);
apply_optimizations(b, 0, optimization_type::optimization_type_symbolic_rewrite_pass_forced, 0);
vtil::debug::dump(b);
}
After a bit of messing around, I've narrowed down the cause to the register naming. Rewriting all register names to a higher index produces the following instead:
The following code is producing corrupt results:
After a bit of messing around, I've narrowed down the cause to the register naming. Rewriting all register names to a higher index produces the following instead:
The pass appears to be restoring to the original registers, and is clobbering them in the process.