asm_conv: Assertion `((IRType)((ir->t).irt & IRT_TYPE)) != st' failed. #37
Comments
It looks like simplify_conv_narrow is always emitting a signed CONV even if the type its folding is U32 Lines 1258 to 1272 in 3f39980
|
Fixes #37. simplify_conv_narrow transforms a 64-bit to 32-bit int conversion after an operation (e.g. add, sub, mul) to an op of the converted operands by simply converting the operands into 32-bit int. It however fails to update the destination type of the conversion mode because of which one ends up with inconsistent IR and fails with an assertion. The test case is incorporated into this patch but it doesn't actually get executed in the make check. ffi_convert.lua needs extensive fixing up to enable it in the testsuite and is currently out of scope for 2.1.2. Signed-off-by: Siddhesh Poyarekar <siddhesh@gotplt.org> Signed-off-by: spacewander <spacewanderlzx@gmail.com>
Fixes #37. simplify_conv_narrow transforms a 64-bit to 32-bit int conversion after an operation (e.g. add, sub, mul) to an op of the converted operands by simply converting the operands into 32-bit int. It however fails to update the destination type of the conversion mode because of which one ends up with inconsistent IR and fails with an assertion. The test case is incorporated into this patch but it doesn't actually get executed in the make check. ffi_convert.lua needs extensive fixing up to enable it in the testsuite and is currently out of scope for 2.1.2. Signed-off-by: Siddhesh Poyarekar <siddhesh@gotplt.org> Signed-off-by: spacewander <spacewanderlzx@gmail.com>
Thanks for the tip, that helped me find the problem immediately. The INT assumption is fine, just that the conversion mode is not updated to reflect that reality. I've posted (and will push soon) #39 that should fix this problem. |
Fixes #37. simplify_conv_narrow transforms a 64-bit to 32-bit int conversion after an operation (e.g. add, sub, mul) to an op of the converted operands by simply converting the operands into 32-bit int. It however fails to update the destination type of the conversion mode because of which one ends up with inconsistent IR and fails with an assertion. The test case is incorporated into this patch but it doesn't actually get executed in the make check. ffi_convert.lua needs extensive fixing up to enable it in the testsuite and is currently out of scope for 2.1.2. Signed-off-by: Siddhesh Poyarekar <siddhesh@gotplt.org> Signed-off-by: spacewander <spacewanderlzx@gmail.com>
Fixes #37. simplify_conv_narrow transforms a 64-bit to 32-bit int conversion after an operation (e.g. add, sub, mul) to an op of the converted operands by simply converting the operands into 32-bit int. It however fails to update the destination type of the conversion mode because of which one ends up with inconsistent IR and fails with an assertion. The test case is incorporated into this patch but it doesn't actually get executed in the make check. ffi_convert.lua needs extensive fixing up to enable it in the testsuite and is currently out of scope for 2.1.2. Signed-off-by: Siddhesh Poyarekar <siddhesh@gotplt.org> Signed-off-by: spacewander <spacewanderlzx@gmail.com>
Fixed in master and v2.1 branch, so 2.1.2 should have this. |
Shouldn't the signedness of the IR op be preserved? |
It doesn't matter for integer ADD, SUB or MUL since they don't care about signedness. There is one tiny issue with this approach: coercing everything to INT has the side effect that That said, in this case the conversion sequence is |
Alternative fix for #37 When emitting CONV make sure that its type matches its destination IRType. This keeps IR fully internally consistent with respect to types - i.e. if we push narrowing CONV Dt.St upwards through an arithmetic operation of type St we end up with arithmetic operation of type Dt and two convertions CONV Dt.St which narrow the operands. Previous variantion of the fix introduced slight inconsistency with types (inserted convertions were CONV int.St while arithmetic operation was still of type Dt). Signed-off-by: Vyacheslav Egorov <vegorov@google.com>
Hi, I have seen your email in the LuaJIT mail list. It is a good news that you are pushing LuaJIT ahead.
Several days ago, I submitted a bug report to the LuaJIT but no response is given back.
LuaJIT#524
The bug can be reproduced with the master branch of moonjit, so I think you might feel interested about it.
I have reduced the reproduce script to a few lines:
When the
lua_assert(irt_type(ir->t) != st)
failed,irt_type(ir->t)
isIRT_INT
.So maybe something wrong happens when LuaJIT generates an invalid IR
CONV INT to INT
, triggers assertion failure during converting IR to mcode.The text was updated successfully, but these errors were encountered: