[Mono-bugs] [Bug 48679][Maj] Changed - Unboxed bool is neither true nor false
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Mon, 22 Sep 2003 22:46:16 -0400 (EDT)
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 mass@akuma.org.
http://bugzilla.ximian.com/show_bug.cgi?id=48679
--- shadow/48679 2003-09-22 21:19:42.000000000 -0400
+++ shadow/48679.tmp.6778 2003-09-22 22:46:16.000000000 -0400
@@ -89,6 +89,39 @@
static object compare(int a, int b)
{
return a >= b;
}
}
+
+------- Additional Comments From mass@akuma.org 2003-09-22 22:46 -------
+assembly generated for T::compare:
+
+ 0: 55 push %ebp
+ 1: 8b ec mov %esp,%ebp
+ 3: 83 ec 04 sub $0x4,%esp
+ 6: 68 1c 8e 12 08 push $0x8128e1c
+ b: e8 57 9e f9 37 call 37f99e67
+<_T_compare+0x37f99e67>
+ 10: 83 c4 04 add $0x4,%esp
+ 13: 89 45 fc mov %eax,0xfffffffc(%ebp)
+ 16: 8b 4d 0c mov 0xc(%ebp),%ecx
+ 19: 39 4d 08 cmp %ecx,0x8(%ebp)
+ 1c: 0f 9c c1 setl %cl
+ 1f: 0f b6 c9 movzbl %cl,%ecx
+ 22: 83 e9 01 sub $0x1,%ecx
+ 25: 88 48 08 mov %cl,0x8(%eax)
+ 28: 8b 45 fc mov 0xfffffffc(%ebp),%eax
+ 2b: c9 leave
+ 2c: c3 ret
+
+two problems:
+22: 83 e9 01 sub $0x1,%ecx
+
+this does %ecx = %ecx - 1, not %ecx = 1 - %ecx . This is why the
+number returned with my unsafe cast above ends with 0xff
+
+25: 88 48 08 mov %cl,0x8(%eax)
+
+this is the byte copy, not word copy. making the unsafe assumption
+that the value that eax + 0x8 points to is not preset to zero, this
+leaves garbage in the high bytes.