Closed Wall-AF closed 2 months ago
This could be a red herring, but I'm unsure. Because of what the TEST
/JGE
is guarding, I can't believe it to be unreachable. If it were, surely the compiler would have eliminated it?
The decompiler's analysis looks valid to me. The TEST / JGE branches if ECX is greater than or equal to zero, which is always true because the XOR ECX,ECX clears the sign bit and the MOV CL,byte ptr [...] doesn't alter it.
@caheckman I came to the same conclusion, but .... I wonder if there's some undocumented thing going on that, back in the day, treated that prticular MOV
opcode as a signed one, or that the particular segment definition ensured the TEST
just used CL
or something else wierd? Because of the assembly and what it's doing, I can't believe the original developers would have missed that, and surely the compiler would've removed that code entirely during optimisation if it was unreachable??? What do you think?
Closing because there doesn't seem to be a problem with Ghidra. The conversation can continue in the "closed" state.
Describe the bug A
condition
based upon the contents of a global byte array (initially within an undefined memory block, but recently joined with its predecessor to make one contiguous area, as the array spanned both areas when loaded into Ghidra) is being treated as having a value of0
when interpreted by the decompiler, even if the mutability is changed fromnormal
tovolatile
-normal
should work. This is leading to incorrect C code. I.e. instead ofor nothing (if option
Eliminate unreachable code
ison
), we should see(edited the condition to be
<
)the assembly that is corresponding to
if (false) {
isTo Reproduce Steps to reproduce the behavior:
Decompile:
PanelsDebug Function Decompilation
menu)Expected behavior The enclosing guard condition should not be deemed superfluous and should appear in the reproduced C code.
Screenshots N/A
Attachments dd25hook_FUN_10007bb7.zip
Environment (please complete the following information):
Additional context This is a 32-bit DLL compiled with MSVC 4.1/4.2 compiler.