Fix #77958
authorRaja R Harinath <harinath@hurrynot.org>
Sat, 1 Apr 2006 13:53:12 +0000 (13:53 -0000)
committerRaja R Harinath <harinath@hurrynot.org>
Sat, 1 Apr 2006 13:53:12 +0000 (13:53 -0000)
* mcs/statement.cs (Switch.EmitObjectInteger) [ulong]: Remove bad cast.
* gmcs/statement.cs: Likewise.
* tests/test-499.cs: New test from #77958.

(test-499.cs appears to trigger a JIT bug)

svn path=/trunk/mcs/; revision=58889

mcs/gmcs/ChangeLog
mcs/gmcs/statement.cs
mcs/mcs/ChangeLog
mcs/mcs/statement.cs
mcs/tests/ChangeLog
mcs/tests/known-issues-gmcs
mcs/tests/known-issues-mcs
mcs/tests/test-499.cs [new file with mode: 0644]

index 169ab47abc59b7f4e97c24f5b1c6730e280b988b..4584fe5cfb5e901c3d5d624ba4ef3ec5ca1dab49 100644 (file)
@@ -1,12 +1,13 @@
 2006-04-01  Raja R Harinath  <rharinath@novell.com>
 
+       Fix #77958
+       * statement.cs (Switch.EmitObjectInteger) [ulong]: Remove bad cast.
+
        Fix #77962
        * report.cs (SymbolRelatedToPreviousError): Drop generic type
        arguments before checking whether a type is reflected or not.
 
-2006-04-01  Raja R Harinath  <rharinath@novell.com>
-
-       Fix #77954.
+       Fix #77954
        * expression.cs (Invocation.IsApplicable): Ensure a generic method
        definition doesn't take part in overload resolution.
        (Invocation.IsParamsMethodApplicable): Likewise.
index bd9f19fed0100de14a98a07728ca53da5079fe42..7519a2f59dda8e8fe3aa2ba43eef8f55250751e4 100644 (file)
@@ -2580,14 +2580,15 @@ namespace Mono.CSharp {
                        }
                        else if (k is ulong)
                        {
-                               if ((ulong) k < (1L<<32))
+                               ulong ul = (ulong) k;
+                               if (ul < (1L<<32))
                                {
-                                       IntConstant.EmitInt (ig, (int) (long) k);
+                                       IntConstant.EmitInt (ig, unchecked ((int) ul));
                                        ig.Emit (OpCodes.Conv_U8);
                                }
                                else
                                {
-                                       LongConstant.EmitLong (ig, unchecked ((long) (ulong) k));
+                                       LongConstant.EmitLong (ig, unchecked ((long) ul));
                                }
                        }
                        else if (k is char)
index 5e8c5d85d471ef2746d1bd68b3f35b1af75c5dde..8658ba8167dc778e9e0b2eb782c857b491a664dc 100644 (file)
@@ -1,3 +1,8 @@
+2006-04-01  Raja R Harinath  <rharinath@novell.com>
+
+       Fix #77958
+       * statement.cs (Switch.EmitObjectInteger) [ulong]: Remove bad cast.
+
 2006-04-01  Marek Safar  <marek.safar@seznam.cz>
 
        A fix for #77966.
index 6b08fb7abff58116b7fb6eea5b53671ef2f3bb3b..9e1c7abea800fa543ec36576da882e729d47b8f5 100644 (file)
@@ -2579,14 +2579,15 @@ namespace Mono.CSharp {
                        }
                        else if (k is ulong)
                        {
-                               if ((ulong) k < (1L<<32))
+                               ulong ul = (ulong) k;
+                               if (ul < (1L<<32))
                                {
-                                       IntConstant.EmitInt (ig, (int) (long) k);
+                                       IntConstant.EmitInt (ig, unchecked ((int) ul));
                                        ig.Emit (OpCodes.Conv_U8);
                                }
                                else
                                {
-                                       LongConstant.EmitLong (ig, unchecked ((long) (ulong) k));
+                                       LongConstant.EmitLong (ig, unchecked ((long) ul));
                                }
                        }
                        else if (k is char)
index b33ef0723cda5aa17264782a8b27feb960f19fe9..eec366e24068f9c3223d81d0b1855bd2cee2743a 100644 (file)
@@ -1,3 +1,7 @@
+2006-04-01  Raja R Harinath  <rharinath@novell.com>
+
+       * test-499.cs: New test from #77958.
+
 2006-04-01  Raja R Harinath  <rharinath@novell.com>
 
        * gtest-265.cs, gtest-265-lib.cs: New test from #77954.
index fa5f02cf2cb00693825009af209b948660b1de22..a34c27a86dcc2c3c8f36906fb4d359cf9e36353f 100644 (file)
@@ -12,3 +12,4 @@ test-465.cs IGNORE    # need to fix the path separator to work both on Unix and Win
 test-476.cs
 
 gtest-230.cs
+test-499.cs
index 5cb88fa056f594267ab3a89299ef3395b505f0f7..8d452e481a01a92f51e9e4106235e3d833890878 100644 (file)
@@ -13,3 +13,5 @@ test-476.cs
 
 test-anon-27.cs
 test-xml-027.cs
+
+test-499.cs
diff --git a/mcs/tests/test-499.cs b/mcs/tests/test-499.cs
new file mode 100644 (file)
index 0000000..f6789aa
--- /dev/null
@@ -0,0 +1,10 @@
+class X {
+       static void Main ()
+       {
+               ulong x = 1;
+               switch (x) {
+               case 0:
+                       break;
+               }
+       }
+}