[Mono-bugs] [Bug 79026][Nor] New - mcs reuses loc.0 for two different things within same expression

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Mon Aug 7 12:04:39 EDT 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 gert.driesen at pandora.be.

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

--- shadow/79026	2006-08-07 12:04:39.000000000 -0400
+++ shadow/79026.tmp.11280	2006-08-07 12:04:39.000000000 -0400
@@ -0,0 +1,64 @@
+Bug#: 79026
+Product: Mono: Compilers
+Version: 1.1
+OS: All
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: rharinath at novell.com                            
+ReportedBy: gert.driesen at pandora.be               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: mcs reuses loc.0 for two different things within same expression
+
+Jeroen Frijters reported the following issue on the mono-devel-list:
+
+I ran into a bug in mcs. The program below obviously should print 42,  
+but it prints 0, because mcs reuses loc.0 for two different things within 
+the same expression.
+
+using System;
+
+class Repro
+{
+  private int[] stack = new int[1];
+  private int cc;
+  public int fc;
+  private int sp;
+
+  static int Main()
+  {
+    Repro r = new Repro();
+    r.foo();
+    Console.WriteLine(r.stack[0]);
+    return r.stack[0] == 42 ? 0 : 1;
+  }
+
+  public void foo()
+  {
+    fc = cc = bar();
+    fc = stack[sp++] = cc;
+  }
+
+  private int bar()
+  {
+    return 42;
+  }
+}
+
+Expected result:
+
+42
+
+(and exit code is 0)
+
+Actual result:
+
+0
+
+(and exit code is 1)


More information about the mono-bugs mailing list