[Mono-bugs] [Bug 78826][Wis] New - Mono 1.1.16 crashes on valid tailcall+generics code

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Jul 11 19:50:43 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 bbjamey at gmail.com.

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

--- shadow/78826	2006-07-11 19:50:43.000000000 -0400
+++ shadow/78826.tmp.14776	2006-07-11 19:50:43.000000000 -0400
@@ -0,0 +1,194 @@
+Bug#: 78826
+Product: Mono: Runtime
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: JIT
+AssignedTo: lupus at ximian.com                            
+ReportedBy: bbjamey at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Mono 1.1.16 crashes on valid tailcall+generics code
+
+Description of Problem: Mono 1.1.16 crashes on valid tailcall+generics 
+code
+
+
+Steps to reproduce the problem:
+1. ILASM and run the IL code below (e.g. using .NET ILASM). This works 
+on .NET Windows.  Mono gives
+
+Unhandled Exception: System.InvalidProgramException: Invalid IL code in 
+Maine:M2
+ (int,int): IL_0024: call      0x2b000001
+
+
+  at <0x00000> <unknown method>
+  at Maine.Main () [0x00000]
+
+
+
+
+//  Microsoft (R) .NET Framework IL Disassembler.  Version 2.0.50727.42
+//  Copyright (c) Microsoft Corporation.  All rights reserved.
+
+
+
+// Metadata version: v2.0.50727
+.assembly extern mscorlib
+{
+  .publickeytoken = (B7 7A 5C 56 19 34 E0 
+89 )                         // .z\V.4..
+  .ver 2:0:0:0
+}
+.assembly bug
+{
+  .custom instance void [mscorlib]
+System.Runtime.CompilerServices.CompilationRelaxationsAttribute::.ctor
+(int32) = ( 01 00 08 00 00 00 00 00 ) 
+  .custom instance void [mscorlib]
+System.Runtime.CompilerServices.RuntimeCompatibilityAttribute::.ctor() = 
+( 01 00 01 00 54 02 16 57 72 61 70 4E 6F 6E 45 78   // ....T..WrapNonEx
+                                                                          
+                                   63 65 70 74 69 6F 6E 54 68 72 6F 77 73 
+01 )       // ceptionThrows.
+  .hash algorithm 0x00008004
+  .ver 0:0:0:0
+}
+.module bug.exe
+// MVID: {2529DA8A-C8D4-4653-BA0C-4DC9C45594EB}
+.imagebase 0x00400000
+.file alignment 0x00000200
+.stackreserve 0x00100000
+.subsystem 0x0003       // WINDOWS_CUI
+.corflags 0x00000001    //  ILONLY
+// Image base: 0x00EF0000
+
+
+// =============== CLASS MEMBERS DECLARATION ===================
+
+.class private auto ansi beforefieldinit Maine
+       extends [mscorlib]System.Object
+{
+  .method private hidebysig static class [mscorlib]
+System.Collections.Generic.List`1<!!T> 
+          M1<T,U>(class [mscorlib]System.Collections.Generic.List`1<!!T> 
+a,
+                  !!U b) cil managed
+  {
+    // Code size       19 (0x13)
+    .maxstack  2
+    .locals init (class [mscorlib]System.Collections.Generic.List`1<!!T> 
+V_0)
+    IL_0000:  nop
+    IL_0001:  ldarg.0
+    IL_0002:  callvirt   instance int32 class [mscorlib]
+System.Collections.Generic.List`1<!!T>::get_Count()
+    IL_0007:  ldc.i4.0
+    IL_0008:  blt.s      IL_000d
+
+    IL_000a:  ldarg.0
+    IL_000b:  br.s       IL_000e
+
+    IL_000d:  ldarg.0
+    IL_000e:  stloc.0
+    IL_000f:  br.s       IL_0011
+
+    IL_0011:  ldloc.0
+    IL_0012:  ret
+  } // end of method Maine::M1
+
+  .method private hidebysig static class [mscorlib]
+System.Collections.Generic.List`1<int32> 
+          M2<T>(int32 x,
+                !!T y) cil managed
+  {
+    // Code size       44 (0x2c)
+    .maxstack  2
+    .locals init (class [mscorlib]
+System.Collections.Generic.List`1<int32> V_0,
+             bool V_1)
+    IL_0000:  nop
+    IL_0001:  ldarg.0
+    IL_0002:  ldc.i4.4
+    IL_0003:  clt
+    IL_0005:  ldc.i4.0
+    IL_0006:  ceq
+    IL_0008:  stloc.1
+    IL_0009:  ldloc.1
+    IL_000a:  brtrue.s   IL_001a
+
+    IL_000c:  newobj     instance void class [mscorlib]
+System.Collections.Generic.List`1<int32>::.ctor()
+    IL_0011:  ldc.i4.1
+    IL_0012:  tail. call       class [mscorlib]
+System.Collections.Generic.List`1<!!0> Maine::M1<int32,int32>(class 
+[mscorlib]System.Collections.Generic.List`1<!!0>,
+                                                                          
+                             !!1)
+    IL_0017:  ret
+
+    IL_001a:  ldarg.0
+    IL_001b:  ldarg.1
+    IL_001c:  call       class [mscorlib]
+System.Collections.Generic.List`1<int32> Maine::M2<!!0>(int32,
+                                                                          
+                       !!0)
+    IL_0021:  ldc.i4.2
+    IL_0022:  tail. call       class [mscorlib]
+System.Collections.Generic.List`1<!!0> Maine::M1<int32,int32>(class 
+[mscorlib]System.Collections.Generic.List`1<!!0>,
+                                                                          
+                             !!1)
+    IL_002b:  ret
+  } // end of method Maine::M2
+
+  .method private hidebysig static void  Main() cil managed
+  {
+    .entrypoint
+    // Code size       10 (0xa)
+    .maxstack  8
+    IL_0000:  nop
+    IL_0001:  ldc.i4.1
+    IL_0002:  ldc.i4.2
+    IL_0003:  call       class [mscorlib]
+System.Collections.Generic.List`1<int32> Maine::M2<int32>(int32,
+                                                                          
+                         !!0)
+    IL_0008:  pop
+    IL_0009:  ret
+  } // end of method Maine::Main
+
+  .method public hidebysig specialname rtspecialname 
+          instance void  .ctor() cil managed
+  {
+    // Code size       7 (0x7)
+    .maxstack  8
+    IL_0000:  ldarg.0
+    IL_0001:  call       instance void [mscorlib]System.Object::.ctor()
+    IL_0006:  ret
+  } // end of method Maine::.ctor
+
+} // end of class Maine
+
+
+
+
+Expected Results: No crash, successful exit
+
+
+How often does this happen? : All the time
+
+
+Additional Information: Mono tailcalls are badly broken.  This completely 
+messes with the use of any functional languages on Mono.  The above is a 
+condensed test case from F# code.  Why don't the Mono team regularly test 
+against F# code?  Every time I run F# code on Mono I find many bugs in 
+Mono.  There are hundreds of great test cases in the F# samples just 
+waiting for you.  Please test using F# code!!!


More information about the mono-bugs mailing list