uxmal / reko

Reko is a binary decompiler.

Home Page:https://uxmal.github.io/reko

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"Object reference not set to an instance of an object." during Analyze Data Flow step

pladams9 opened this issue · comments

File I am decompiling is "CASTLE1.EXE" from the first link here: http://lkbm.ecritters.biz/cotw/download.html
Version: Reko-0.11.2-x64-6a31a331b5

analysis_99_crash.txt:

// fn004F_21B0 ===========
Object reference not set to an instance of an object.
   at Reko.Analysis.SsaTransform.InsertAfterDefinition(Statement stmBefore, AliasAssignment ass)
   at Reko.Analysis.SsaTransform.FlagGroupTransformer.MakeSlice(ValueTuple`3 elem)
   at Reko.Analysis.SsaTransform.FlagGroupTransformer.ReadBlockLocalVariable(SsaBlockState bs)
   at Reko.Analysis.SsaTransform.IdentifierTransformer.ReadVariable(SsaBlockState bs)
   at Reko.Analysis.SsaTransform.IdentifierTransformer.<AddPhiOperands>b__17_0(Block p)
   at System.Linq.Enumerable.SelectListIterator`2.ToArray()
   at Reko.Analysis.SsaTransform.IdentifierTransformer.AddPhiOperands(SsaIdentifier phi)
   at Reko.Analysis.SsaTransform.IdentifierTransformer.ReadVariableRecursive(SsaBlockState bs)
   at Reko.Analysis.SsaTransform.FlagGroupTransformer.ReadBlockLocalVariable(SsaBlockState bs)
   at Reko.Analysis.SsaTransform.IdentifierTransformer.ReadVariable(SsaBlockState bs)
   at Reko.Analysis.SsaTransform.IdentifierTransformer.ReadVariableRecursive(SsaBlockState bs)
   at Reko.Analysis.SsaTransform.FlagGroupTransformer.ReadBlockLocalVariable(SsaBlockState bs)
   at Reko.Analysis.SsaTransform.IdentifierTransformer.ReadVariable(SsaBlockState bs)
   at Reko.Analysis.SsaTransform.<>c__DisplayClass25_0.<AddUsesToExitBlock>b__7(Statement u)
   at System.Collections.Generic.List`1.ForEach(Action`1 action)
   at Reko.Analysis.DataFlowAnalysis.ConvertToSsa(Procedure proc)


// fn004F_21B0
// Return size: 4
define fn004F_21B0
fn004F_21B0_entry:
	def fp
	def cl
	def dx
	def ax
	sp_2 = fp
	Top_3 = 0<i8>
	// succ:  l004F_21B0
l004F_21B0:
	ch_4 = 0<8>
	SZO_5 = cond(0<8>)
	O_29 = SLICE(SZO_5, bool, 4) (alias)
	C_6 = false
	cx_8 = CONVERT(cl, byte, uint16) (alias)
	branch cx_8 == 0<16> l004F_21BA
	// succ:  l004F_21B4 l004F_21BA
l004F_21B4:
	cx_17 = PHI((cx_8, l004F_21B0), (cx_18, l004F_21B4))
	ax_12 = PHI((ax, l004F_21B0), (ax_15, l004F_21B4))
	dx_9 = PHI((dx, l004F_21B0), (dx_10, l004F_21B4))
	v13_21 = dx_9
	v9_13 = (ax_12 & 2<16>) != 0<16>
	v14_22 = ax_12
	v15 = SEQ(dx_9, ax_12) >>u 1<8>
	dx_10 = SLICE(v15, word16, 16)
	ax_15 = SLICE(v15, word16, 0)
	C_16 = v9_13
	cx_18 = cx_17 - 1<16>
	branch cx_18 != 0<16> l004F_21B4
	// succ:  l004F_21BA l004F_21B4
l004F_21BA:
	O_28 = PHI()
	dx_27 = PHI((dx, l004F_21B0), (dx_10, l004F_21B4))
	cx_26 = PHI((cx_8, l004F_21B0), (cx_18, l004F_21B4))
	C_25 = PHI((C_6, l004F_21B0), (C_16, l004F_21B4))
	ax_24 = PHI((ax, l004F_21B0), (ax_15, l004F_21B4))
	return
	// succ:  fn004F_21B0_exit
fn004F_21B0_exit:
	use ax_24
	use C_25
	use cx_26
	use dx_27
	use O
	use S
	use sp
	use Top
	use Z

Thanks for taking the time to report this, with a thorough repro case. The bug was fixed, and in addition, the way "long right shifts" (pairs of shr / rcr instructions) is now much improved.