[Mono-bugs] [Bug 75934][Nor] New - gmcs generates duplicate field names for iterator code

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Aug 30 03:43:13 EDT 2005


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 jankit at novell.com.

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

--- shadow/75934	2005-08-30 03:43:13.000000000 -0400
+++ shadow/75934.tmp.21712	2005-08-30 03:43:13.000000000 -0400
@@ -0,0 +1,69 @@
+Bug#: 75934
+Product: Mono: Compilers
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: jankit at novell.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: gmcs generates duplicate field names for iterator code
+
+test case:
+
+using System;
+using System.Collections;
+
+class test
+{
+        public IEnumerable testen (int x)
+        {
+                for (int i = 0;i < x; i++)
+                        if (i % 2 == 0) {
+                                int o = i;
+                                yield return o;
+                        } else {
+                                int o = i*2;
+                                yield return o;
+                        }
+        }
+}
+
+compiled with gmcs and then monodis :
+
+... <snip>
+  .class nested private auto ansi beforefieldinit '<testen>__0'
+        extends [mscorlib]System.Object
+        implements [mscorlib]System.Collections.IEnumerable, class
+[mscorlib]System.Collections.Generic.'IEnumerable`1'<object>,
+[mscorlib]System.Collections.IEnumerator, [mscorlib]System.IDisposable,
+class [mscorlib]System.Collections.Generic.'IEnumerator`1'<object>  {
+    .field  private   int32 $PC
+    .field  private   object $current
+    .field  assembly   class test '<>THIS'
+    .field  assembly   int32 '<p:x>'
+
+    .field  assembly   int32 i
+    .field  assembly   int32 o ->>>>> 
+    .field  assembly   int32 o ->>>>>Duplicate fields
+
+... <snip>
+
+Compiled with csc (2.0) and ildasm'ed, 
+
+... <snip>
+
+    .field /*04000004*/ public int32 '<>3__x'
+    .field /*04000005*/ public int32 '<i>5__1'
+    .field /*04000006*/ public int32 '<o>5__2'
+    .field /*04000007*/ public int32 '<o>5__3'
+... <snip>
+
+ilasm is not able to compile duplicate field names.


More information about the mono-bugs mailing list