Comment #1 by default_357-line — 2017-10-26T14:53:08Z
Simplified a bit:
struct Array
{
long length, ptr;
}
struct Struct
{
bool b = true;
}
void fun1(int) { }
void fun2(Array arr, int, int)
{
assert(!arr.length);
}
void fn(Struct* str)
{
Array arr;
if (!str) return;
if (str)
{
fun1(str.b);
}
if (str.b)
{
fun2(arr, str.b, 0);
}
}
void main()
{
Struct s;
fn(&s);
}
Comment #2 by default_357-line — 2017-10-26T16:10:57Z
Hah! It tries to reload the cse into ESI, but since that's a 1-byte operation (since bool), it actually becomes a move to DH. ESI is not even reachable with 1-byte ops, because those register values were used to address high regs. So for reg8 opcodes like 0x8A, code->setReg should assert on reg & 4.
How to actually fix this though, no idea.
Comment #3 by default_357-line — 2017-10-27T15:00:41Z