[Mono-bugs] [Bug 35128][Nor] Changed - incorrect code when calling a method on a field valuetype

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
5 Dec 2002 12:13:16 -0000


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=35128

--- shadow/35128	Thu Dec  5 01:29:55 2002
+++ shadow/35128.tmp.4397	Thu Dec  5 07:13:16 2002
@@ -1,23 +1,23 @@
 Bug#: 35128
-Product: Mono/Class Libraries
+Product: Mono/MCS
 Version: unspecified
 OS: All
 OS Details: 
 Status: NEW   
 Resolution: 
 Severity: Unknown
 Priority: Normal
-Component: System
+Component: Misc
 AssignedTo: mono-bugs@ximian.com                            
 ReportedBy: juancri@tagnet.org               
 QAContact: mono-bugs@ximian.com
 TargetMilestone: ---
 URL: 
 Cc: 
-Summary: ToString() produces unexpected text
+Summary: incorrect code when calling a method on a field valuetype
 
 Description of Problem:
 When you call the SubString() method of an int that is a class property 
 (uff) it produces unexpected output.
 
 Steps to reproduce the problem:
@@ -62,6 +62,20 @@
 (Sorry.. I've got stress)
 
 ------- Additional Comments From juancri@tagnet.org  2002-12-05 01:29 -------
 oops 2:
 
 When it's compiled with "CSC" it shows 1 in all cases
+
+------- Additional Comments From lupus@ximian.com  2002-12-05 07:13 -------
+This is a mcs bug, the call:
+Console.WriteLine("Object hello: {0}", hello.Id.ToString());
+is miscompiled:
+	IL_003a: ldstr "Object hello: {0}"
+	IL_003f: ldloca.s 0
+	IL_0041: ldflda  int32 MyObject::Id
+	IL_0046: call instance string valuetype [corlib]System.Int32::ToString()
+	IL_004b: call void class [corlib]System.Console::WriteLine(string,
+object)
+
+Note the ldloca to load the MyObject instance (it's a class, so it
+should use ldloc).