[Mono-bugs] [Bug 48679][Maj] Changed - Unboxed bool is neither true nor false

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Tue, 23 Sep 2003 04:34:38 -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 lupus@ximian.com.

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

--- shadow/48679	2003-09-22 22:46:16.000000000 -0400
+++ shadow/48679.tmp.10194	2003-09-23 04:34:38.000000000 -0400
@@ -1,16 +1,16 @@
 Bug#: 48679
-Product: Mono/Runtime
+Product: Mono/MCS
 Version: unspecified
 OS: unknown
 OS Details: 
 Status: NEW   
 Resolution: 
 Severity: Unknown
 Priority: Major
-Component: misc
+Component: Misc
 AssignedTo: mono-bugs@ximian.com                            
 ReportedBy: bmaurer@users.sf.net               
 QAContact: mono-bugs@ximian.com
 TargetMilestone: ---
 URL: 
 Cc: 
@@ -122,6 +122,28 @@
 
 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.
+
+------- Additional Comments From lupus@ximian.com  2003-09-23 04:34 -------
+mcs here generates incorrect code for the comparison:
+	IL_0000: ldarg.0 
+	IL_0001: ldarg.1 
+	IL_0002: clt 
+	IL_0004: ldc.i4.1 
+	IL_0005: sub 
+	IL_0006: box [mscorlib]System.Boolean
+	IL_000b: ret 
+clt returns either 1 or 0: mcs subtracts 1 from the result, but 0 -1
+=> -1 is not a valid boolean value.
+csc generates the correct code (comparison to 0 after the clt):
+	IL_0000: ldarg.0 
+	IL_0001: ldarg.1 
+	IL_0002: clt 
+	IL_0004: ldc.i4.0 
+	IL_0005: ceq 
+	IL_0007: box [mscorlib]System.Boolean
+
+The final one byte copy is correct, since a bool is 1-byte sized.
+