[Mono-bugs] [Bug 77221][Maj] New - MCS generates wrong code for
calling a value type method.
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Thu Jan 12 07:02:15 EST 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 lluis at ximian.com.
http://bugzilla.ximian.com/show_bug.cgi?id=77221
--- shadow/77221 2006-01-12 07:02:15.000000000 -0500
+++ shadow/77221.tmp.8848 2006-01-12 07:02:15.000000000 -0500
@@ -0,0 +1,51 @@
+Bug#: 77221
+Product: Mono: Compilers
+Version: 1.1
+OS:
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Major
+Component: C#
+AssignedTo: rharinath at novell.com
+ReportedBy: lluis at ximian.com
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: MCS generates wrong code for calling a value type method.
+
+This is the test case:
+
+using System;
+
+public class Test
+{
+ public static void Main ()
+ {
+ string[] aPath = {"a","b"};
+ char c = '.';
+
+ string erg = "";
+
+ // This works:
+ // string s1 = c.ToString ();
+ // erg += String.Join (s1, aPath);
+
+ // This gives the wrong result
+ erg += String.Join (c.ToString (), aPath);
+
+ Console.WriteLine (erg);
+ }
+}
+
+This test case prints 'aSystem.Charb', while it should print 'a.b'.
+I think the culprit is here:
+
+ IL_0021: ldloc.1
+ IL_0022: box [mscorlib]System.Char
+ IL_0027: call instance string object::ToString()
+
+Since the result of 'box' is of type System.Object, shouldn't IL_0027 be a
+callvirt?
More information about the mono-bugs
mailing list