1

Closed

NewILToCodeModel: extraneous IDupValue

description

I've attached a tiny test program that demonstrates what I think is an issue with NewILToCodeModel.

If you build something with this function:
static void Decrement()
{
--m_nBlah;
}

then the AST produced by NewILToCodeModel will contain an IDupValue in that function without having an IPushStatement preceding it.



Short "repro":

- Open the attached zip and look at bin\Debug\ccibug-stack.txt
- Note that the only C# code generated in the Decrement() function contains a "dup" reference (from an IDupValue node)


Full repro:

- Build the ccibug-stack.txt project
- Run petotext.exe on the produced exe
- Look at the generated ccibug-stack.txt file
- Note that the only C# code generated in the Decrement() function contains a "dup" reference (from an IDupValue node)

Closed Sat at 1:35 AM by hermanv


comments

hermanv wrote Jan 28 at 3:37 PM

The new decompiler now handles such expressions without resorting to explicit stack manipulation instructions (or introducing new locals).

hermanv wrote Jan 24 at 3:29 AM

I agree that this does look weird and I'd like to fix it. However, it is not actually incorrect. The Dup is int the context of a left hand side that pushes its this object before the right hand side is evaluated.

To really fix this, I need to add CodeModel support for expressing the idea of an expression that has both left hand side and right hand side behavior.