https://bugzilla.novell.com/show_bug.cgi?id=389073
Summary: Bad IntPtr typecast Product: Mono: Compilers Version: SVN Platform: Other OS/Version: Other Status: NEW Severity: Normal Priority: P5 - None Component: C# AssignedTo: mono-bugs@lists.ximian.com ReportedBy: [EMAIL PROTECTED] QAContact: mono-bugs@lists.ximian.com Found By: --- gmcs compile this code private long CastUIntPtrToInt64 (UIntPtr ptr) { return (long) ptr; } into this IL_0000: ldarg.1 IL_0001: call System.UInt32 System.UIntPtr::op_Explicit(System.UIntPtr) IL_0006: conv.u8 IL_0007: ret Converting to U8 (why not I8 ?) won't give back the 32bits lost, which is a problem on all 64bits platforms. MS csc generates this L_0000: ldarg.1 L_0001: call uint64 [mscorlib]System.UIntPtr::op_Explicit(native unsigned int) L_0006: ret Another case (not as bad) is: System.UInt32 CastIntPtrToUInt32(System.IntPtr) mcs: IL_0000: ldarg.1 IL_0001: call System.Int64 System.IntPtr::op_Explicit(System.IntPtr) IL_0006: conv.u4 IL_0007: ret csc L_0000: ldarg.1 L_0001: call int32 [mscorlib]System.IntPtr::op_Explicit(native int) L_0006: ret There could be other cases too... they just did not trigger my new rule :-) -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are the QA contact for the bug. You are the assignee for the bug. _______________________________________________ mono-bugs maillist - mono-bugs@lists.ximian.com http://lists.ximian.com/mailman/listinfo/mono-bugs