2010-04-01 Zoltan Varga <vargaz@gmail.com>
authorZoltan Varga <vargaz@gmail.com>
Thu, 1 Apr 2010 01:35:54 +0000 (01:35 -0000)
committerZoltan Varga <vargaz@gmail.com>
Thu, 1 Apr 2010 01:35:54 +0000 (01:35 -0000)
* decompose.c (mono_decompose_opcode): Set the cfg exception if the unsupported
float conv.ovf.un opcodes are encountered, instead of asserting later.
Fixes #566296.

svn path=/trunk/mono/; revision=154599

mono/mini/ChangeLog
mono/mini/decompose.c
mono/mini/method-to-ir.c

index c9cbb6acec8dd44230c5433828fc2431408f9649..b3c559932d752929cba3138803aa884294a19121 100755 (executable)
@@ -1,3 +1,9 @@
+2010-04-01  Zoltan Varga  <vargaz@gmail.com>
+
+       * decompose.c (mono_decompose_opcode): Set the cfg exception if the unsupported
+       float conv.ovf.un opcodes are encountered, instead of asserting later.
+       Fixes #566296.
+
 2010-04-01  Zoltan Varga  <vargaz@gmail.com>
 
        * decompose.c (mono_decompose_opcode): Add OP_ICONV_TO_U4_UN as a no-op.
index 90f482dd6041a51d345d26e05ec17d71c60a4cfd..8fa6bb3eb3c00b8d2165ed54cc2eef8dcee851d6 100644 (file)
@@ -28,6 +28,7 @@ void mini_emit_initobj (MonoCompile *cfg, MonoInst *dest, const guchar *ip, Mono
  * Returns a MonoInst which represents the result of the decomposition, and can
  * be pushed on the IL stack. This is needed because the original instruction is
  * nullified.
+ * Sets the cfg exception if an opcode is not supported.
  */
 MonoInst*
 mono_decompose_opcode (MonoCompile *cfg, MonoInst *ins)
@@ -162,6 +163,20 @@ mono_decompose_opcode (MonoCompile *cfg, MonoInst *ins)
                ins->opcode = OP_FMOVE;
                break;
 
+       case OP_FCONV_TO_OVF_I1_UN:
+       case OP_FCONV_TO_OVF_I2_UN:
+       case OP_FCONV_TO_OVF_I4_UN:
+       case OP_FCONV_TO_OVF_I8_UN:
+       case OP_FCONV_TO_OVF_U1_UN:
+       case OP_FCONV_TO_OVF_U2_UN:
+       case OP_FCONV_TO_OVF_U4_UN:
+       case OP_FCONV_TO_OVF_U8_UN:
+       case OP_FCONV_TO_OVF_I_UN:
+       case OP_FCONV_TO_OVF_U_UN:
+               cfg->exception_type = MONO_EXCEPTION_INVALID_PROGRAM;
+               cfg->exception_message = g_strdup_printf ("float conv.ovf.un opcodes not supported.");
+               break;
+
                /* Long opcodes on 64 bit machines */
 #if SIZEOF_REGISTER == 8
        case OP_LCONV_TO_I4:
index 2d43541ae2f6f01ebfa0952b9663812e8714fa45..d356f3abafb655b39233e2afbe5627b6cccd2da7 100644 (file)
@@ -7167,6 +7167,7 @@ mono_method_to_ir (MonoCompile *cfg, MonoMethod *method, MonoBasicBlock *start_b
                case CEE_CONV_U:
                        CHECK_STACK (1);
                        ADD_UNOP (*ip);
+                       CHECK_CFG_EXCEPTION;
                        ip++;
                        break;
                case CEE_ADD_OVF: