Author: zoltan
Date: 2007-03-22 11:42:30 -0500 (Thu, 22 Mar 2007)
New Revision: 74815
Modified:
trunk/mono/mono/mini/ChangeLog
trunk/mono/mono/mini/basic.cs
trunk/mono/mono/mini/cfold.c
Log:
2007-03-22 Zoltan Varga <[EMAIL PROTECTED]>
* 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.
Modified: trunk/mono/mono/mini/ChangeLog
===================================================================
--- trunk/mono/mono/mini/ChangeLog 2007-03-22 16:14:02 UTC (rev 74814)
+++ trunk/mono/mono/mini/ChangeLog 2007-03-22 16:42:30 UTC (rev 74815)
@@ -1,3 +1,10 @@
+2007-03-22 Zoltan Varga <[EMAIL PROTECTED]>
+
+ * 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 <[EMAIL PROTECTED]>
* inssel.brg basic.cs: Revert previous change to fix build.
Modified: trunk/mono/mono/mini/basic.cs
===================================================================
--- trunk/mono/mono/mini/basic.cs 2007-03-22 16:14:02 UTC (rev 74814)
+++ trunk/mono/mono/mini/basic.cs 2007-03-22 16:42:30 UTC (rev 74815)
@@ -1274,4 +1274,12 @@
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;
+ }
}
Modified: trunk/mono/mono/mini/cfold.c
===================================================================
--- trunk/mono/mono/mini/cfold.c 2007-03-22 16:14:02 UTC (rev 74814)
+++ trunk/mono/mono/mini/cfold.c 2007-03-22 16:42:30 UTC (rev 74815)
@@ -29,7 +29,7 @@
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;
@@ -43,7 +43,7 @@
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; \
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches