[Mono-bugs] [Bug 75320][Maj] New - [GMCS] references to static generic fields are compiled to unverifiable code

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sun Jun 19 16:28:04 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 nazgul at omega.pl.


--- shadow/75320	2005-06-19 16:28:04.000000000 -0400
+++ shadow/75320.tmp.8387	2005-06-19 16:28:04.000000000 -0400
@@ -0,0 +1,88 @@
+Bug#: 75320
+Product: Mono: Compilers
+Version: 1.0
+OS Details: mono svn 17.06.2005
+Status: NEW   
+Priority: Major
+Component: C#
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: nazgul at omega.pl               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+Summary: [GMCS] references to static generic fields are compiled to unverifiable code
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+When I have a reference to static field in generic class from external
+library it is emitted to IL with instanciated signature - csc, MS S.R.E,
+gmcs (for references in current assembly) produces noninstanciated
+signatures of generic member references, so I assume this is according to
+the spec. But when gmcs compile reference to external lib, the created
+assembly do not work on MS.NET 2.0 Beta 2
+Steps to reproduce the problem:
+1. Compile gmcs tlib.cs /t:library /out:tlib.dll
+public class A <T> {
+  public static A<T> _N_constant_object = new A<T> ();
+2. Compile gmcs t.cs  /r:tlib.dll
+class B<T> {
+   public static B<T> _N_constant_object = new B<T> ();
+class M {
+  static void Main () {
+     A<int> x = A<int>._N_constant_object;
+     B<int> y = B<int>._N_constant_object;
+  }
+3. Run on MS.NET  ./t.exe
+Actual Results:
+Unhandled Exception: System.MissingFieldException: Field not found:
+   at M.Main()
+Unknown signal 79
+Expected Results:
+clear run
+How often does this happen? 
+Additional Information:
+PEVerify.exe output:
+.exe t.exe
+Microsoft (R) .NET Framework PE Verifier.  Version  2.0.50215.44
+Copyright (C) Microsoft Corporation. All rights reserved.
+[IL]: Error: [C:\cygwin\home\nazgul\nemerle\ncc\testsuite\t.exe :
+M::Main][offset 0x00000000] Field is not visible.
+1 Error Verifying t.exe
+The problem can be seen in following IL:
+  IL_0000:  ldsfld     class [tlib]A`1<int32> class
+  IL_0005:  stloc.0
+  IL_0006:  ldsfld     class B`1<!0> class B`1<int32>::_N_constant_object
+Also for external lib there should be class [tlib]A`1<!0> class ...
+This is a blocker for running nemerle compiler on MS.NET (because currently
+it can be currently only on mono)

More information about the mono-bugs mailing list