[Mono-bugs] [Bug 56178][Wis] New - mcs crash while referencing const value in another assembly in DlImport

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Mon, 29 Mar 2004 16:56:06 -0500 (EST)


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 vladimir@pobox.com.

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

--- shadow/56178	2004-03-29 16:56:06.000000000 -0500
+++ shadow/56178.tmp.29067	2004-03-29 16:56:06.000000000 -0500
@@ -0,0 +1,57 @@
+Bug#: 56178
+Product: Mono: Compilers
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Wishlist
+Component: C#
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: vladimir@pobox.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: mcs crash while referencing const value in another assembly in DlImport
+
+Using mono/mcs from CVS, as of 3/29.  Given these two files:
+
+===== bug20-a.cs ====
+using System;
+using System.Runtime.InteropServices;
+
+namespace Foo {
+  public class Bar {
+    public const CallingConvention CConv = CallingConvention.Cdecl;
+  }
+}
+
+===== bug20-b.cs ====
+using System;
+using System.Runtime.InteropServices;
+
+namespace Foo {
+  public class Baz {
+    [DllImport("foo.so", CallingConvention=Bar.CConv)]
+    public static extern void doFoo();
+  }
+}
+
+==== Output ====
+vladimir@river[1009]% mcs /target:library bug20-a.cs
+Compilation succeeded
+vladimir@river[1010]% mcs /target:library /r:bug20-a.dll bug20-b.cs |& head -20
+
+Unhandled Exception: System.StackOverflowException: The requested operation
+caused a stack overflow.
+in <0x00514> Mono.CSharp.Expression:Constantify (object,System.Type)
+in <0x0054e> Mono.CSharp.Expression:Constantify (object,System.Type)
+in <0x0054e> Mono.CSharp.Expression:Constantify (object,System.Type)
+in <0x0054e> Mono.CSharp.Expression:Constantify (object,System.Type)
+in <0x0054e> Mono.CSharp.Expression:Constantify (object,System.Type)
+....
+
+leading to a segfault.  Note that other consts work fine -- i.e. using a
+const string and passing it for EntryName has no problems.