lifting-bits / fcd

An optimizing decompiler (modified to use remill semantics)
http://zneak.github.io/fcd
Other
30 stars 3 forks source link

Bad value replacement in `ConvertRemillArgsToLocals()` #41

Open nickolas-pohilets opened 5 years ago

nickolas-pohilets commented 5 years ago

I've built FCD+Remill using Debug build of LLVM 4.0 to investigate other issue, but encountered this first:

In pass_argrec_remill.cpp:341 in function ConvertRemillArgsToLocals()

  auto pc_type = remill::AddressType(module);
  auto arg_pc = remill::NthArgument(func, remill::kPCArgNum);
  auto loc_pc = ir.CreateAlloca(pc_type, nullptr, "loc_pc");
  arg_pc->replaceAllUsesWith(loc_pc);
Assertion failed: (New->getType() == getType() && "replaceAllUses of value with new value of different type!"), function doRAUW, file ../llvm/lib/IR/Value.cpp, line 375.
(lldb) p arg_pc->dump()
i64 %pc
(lldb) p loc_pc->dump()
  %loc_pc = alloca i64
(lldb) p arg_pc->getType()->dump()
i64
(lldb) p loc_pc->getType()->dump()
i64*