From bc7a2bd9fe8c389a3b622a1456e10a7ed606f9dd Mon Sep 17 00:00:00 2001 From: Kyungwoo Lee Date: Mon, 4 Jan 2016 13:37:08 -0800 Subject: [PATCH] Fix bad-codegen from ilasm Switch target should be 4 byte instead of 8 byte. In Windows, size of long is same as size of int which is 4 byte, but this is 8 byte in Unix. --- src/ilasm/assembler.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ilasm/assembler.cpp b/src/ilasm/assembler.cpp index 2398ba9..a027a10 100644 --- a/src/ilasm/assembler.cpp +++ b/src/ilasm/assembler.cpp @@ -2105,7 +2105,7 @@ void Assembler::EmitInstrSwitch(Instr* instr, Labels* targets) Labels *pLbls; int NumLabels; Label *pLabel; - long offset; + UINT offset; EmitOpcode(instr); @@ -2134,10 +2134,10 @@ void Assembler::EmitInstrSwitch(Instr* instr, Labels* targets) } else { - offset = (long)(UINT_PTR)pLbls->Label; + offset = (UINT)(UINT_PTR)pLbls->Label; if (m_fDisplayTraceOutput) report->msg("%d\n", offset); } - EmitBytes((BYTE *)&offset, sizeof(long)); + EmitBytes((BYTE *)&offset, sizeof(UINT)); } delete targets; } -- 2.7.4