* cfold.c (FOLD_BINOP): Cast the result to gint32 to prevent overflow problems
on 64 bit machines. Fixes part of #80738.
* basic.cs: Add regression test.
svn path=/trunk/mono/; revision=74815
+2007-03-22 Zoltan Varga <vargaz@gmail.com>
+
+ * cfold.c (FOLD_BINOP): Cast the result to gint32 to prevent overflow problems
+ on 64 bit machines. Fixes part of #80738.
+
+ * basic.cs: Add regression test.
+
2007-03-17 Zoltan Varga <vargaz@gmail.com>
* inssel.brg basic.cs: Revert previous change to fix build.
return 0;
}
+
+ public static int test_0_regress_cprop_80738 () {
+ int hours = Int32.MinValue;
+ int hrssec = (hours * 3600); // break point at (Int32.MaxValue - 596523)
+ long t = ((long)(hrssec) * 1000L);
+
+ return t == 0 ? 0 : 1;
+ }
}
return; \
if (inst->inst_i1->opcode == OP_ICONST) { \
inst->opcode = OP_ICONST; \
- inst->inst_c0 = inst->inst_i0->inst_c0 op inst->inst_i1->inst_c0; \
+ inst->inst_c0 = (gint32)(inst->inst_i0->inst_c0 op inst->inst_i1->inst_c0); \
} \
return;
if (inst->inst_i0->opcode == OP_ICONST) {\
if (inst->inst_i1->opcode == OP_ICONST) { \
inst->opcode = OP_ICONST; \
- inst->inst_c0 = inst->inst_i0->inst_c0 op inst->inst_i1->inst_c0; \
+ inst->inst_c0 = (gint32)(inst->inst_i0->inst_c0 op inst->inst_i1->inst_c0); \
return; \
} else { \
MonoInst *tmp = inst->inst_i0; \