Implement OP_LCONV_TO_I4 using OP_SEXT_I4 instead of OP_LSHR_IMM(0). Fixes #11058.
authorZoltan Varga <vargaz@gmail.com>
Tue, 12 Mar 2013 20:31:54 +0000 (21:31 +0100)
committerZoltan Varga <vargaz@gmail.com>
Tue, 12 Mar 2013 20:32:09 +0000 (21:32 +0100)
mono/mini/decompose.c
mono/mini/objects.cs

index 5398896b18365dd1ec42e03f947df14c29889b35..7504a05bea51a90bb0d53cfc121268bfde645819 100644 (file)
@@ -31,8 +31,7 @@ decompose_long_opcode (MonoCompile *cfg, MonoInst *ins, MonoInst **repl_ins)
 
        switch (ins->opcode) {
        case OP_LCONV_TO_I4:
-               MONO_EMIT_NEW_BIALU_IMM (cfg, OP_LSHR_IMM, ins->dreg, ins->sreg1, 0);
-               NULLIFY_INS (ins);
+               ins->opcode = OP_SEXT_I4;
                break;
        case OP_LCONV_TO_I8:
        case OP_LCONV_TO_I:
index dbe8b40bc723973bda306665597e30a5931f14a1..c7689c42ee476586e5e2f6e50e5bb008043d7ab1 100644 (file)
@@ -1569,5 +1569,13 @@ ncells ) {
                        return 1;
                return 0;
        }
+
+       static int test_0_regress_11058 () {
+               int foo = -252674008;
+               int foo2 = (int)(foo ^ 0xF0F0F0F0); // = 28888
+               var arr = new byte[foo2].Length;
+               return 0;
+       }
+
 }