[Mono-bugs] [Bug 79054][Wis] New - Unable to cast a ulong to a IntPtr

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Thu Aug 10 19:04:42 EDT 2006


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by stephen.gennard at microfocus.com.

http://bugzilla.ximian.com/show_bug.cgi?id=79054

--- shadow/79054	2006-08-10 19:04:42.000000000 -0400
+++ shadow/79054.tmp.24397	2006-08-10 19:04:42.000000000 -0400
@@ -0,0 +1,95 @@
+Bug#: 79054
+Product: Mono: Compilers
+Version: 1.0
+OS: 
+OS Details: Windows XP
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: C#
+AssignedTo: rharinath at novell.com                            
+ReportedBy: stephen.gennard at microfocus.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Unable to cast a ulong to a IntPtr
+
+Description of Problem:
+
+
+Steps to reproduce the problem:
+1.  Create a .cs that contains:
+
+using System;
+
+namespace MicroFocus.MONO.Bugs
+{
+	public class IntPtrTest
+	{
+		public static uint MyVirtualAddress32()
+		{
+			return (uint)2147483647;
+		}
+
+		public static ulong MyVirtualAddress64()
+		{
+			return (ulong)9223372036854775807;
+		}
+
+        	public static int Main()
+        	{
+			IntPtr x = IntPtr.Zero;
+
+			if (IntPtr.Size == 4)
+				x = (IntPtr)MyVirtualAddress32();
+			else
+				x = (IntPtr)MyVirtualAddress64();
+
+			if (x != IntPtr.Zero)
+			{
+				Console.WriteLine("PASS");
+			}
+			else
+			{
+				Console.WriteLine("FAIL");
+			}
+			return 0;
+        	}
+    	}
+}
+
+2. gmcs the above
+
+Actual Results:
+D:\development\netx50\ilrts\mono\bugs>call gmcs IntPtrTest1.cs
+IntPtrTest1.cs(24,10): error CS0030: Cannot convert type `ulong' to 
+`System.IntP
+tr'
+
+
+Expected Results:
+
+D:\development\netx50\ilrts\mono\bugs>csc IntPtrTest1.cs
+Microsoft (R) Visual C# 2005 Compiler version 8.00.50727.42
+for Microsoft (R) Windows (R) 2005 Framework version 2.0.50727
+Copyright (C) Microsoft Corporation 2001-2005. All rights reserved.
+
+
+D:\development\netx50\ilrts\mono\bugs>IntPtrTest1
+PASS
+
+How often does this happen? 
+
+Everytime we cast a ulong to a IntPtr
+
+Additional Information:
+
+The code snippet is from our COBOL compiler's Runtime... Our Runtime
+runs on both 32bit and 64bit, and as such is sensitive to the IntPtr.Size.
+
+Please note, the IntPtr does *NOT* contain a unmanaged physical address
+but contains a value in our own virtual address map.
+
+If you have any questions, please feel free to drop me a line.


More information about the mono-bugs mailing list