Bug 495112

Summary: Can't compile cyclic structs with mono-2.4
Product: [openSUSE] openSUSE 11.2 Reporter: Petr Mladek <pmladek>
Component: MonoAssignee: E-mail List <bnc-team-mono>
Status: RESOLVED DUPLICATE QA Contact: E-mail List <qa-bugs>
Severity: Critical    
Priority: P1 - Urgent CC: coolo, mjsmagalhaes.insc
Version: Factory   
Target Milestone: ---   
Hardware: All   
OS: SUSE Other   
Whiteboard:
Found By: Development Services Priority:
Business Priority: Blocker: ---
Marketing QA Status: --- IT Deployment: ---
Attachments: test file
Workaround to build OOo with the broken mono.

Description Petr Mladek 2009-04-15 12:50:43 UTC
Created attachment 285848 [details]
test file

I am unable to compile the following code with mono-2.4:

--- cut ---
public unsafe struct A
{
    public B * pB;
}

public unsafe struct B
{
    public A * pA;
}
--- cut ---


It fails with the following error:

--- cut ---
$> /usr/bin/mcs -unsafe -target:library test-cyclic-structs.cs
Stack overflow in unmanaged: IP: 0x811db39, fault addr: 0xbf71bff0

Unhandled Exception: Mono.CSharp.InternalErrorException: test-cyclic-structs.cs(6,22): B ---> System.StackOverflowException: The requested operation caused a stack overflow.
  at (wrapper managed-to-native) System.Type:type_is_subtype_of (System.Type,System.Type,bool)
  at System.Type.IsSubclassOf (System.Type c) [0x00000] 
  at System.Reflection.Emit.TypeBuilder.IsSubclassOf (System.Type c) [0x00000] 
  at System.Type.get_IsEnum () [0x00000] 
  at System.Reflection.Emit.TypeBuilder.get_UnderlyingSystemType () [0x00000] 
  at System.Type.Equals (System.Type o) [0x00000] 
  at Mono.CSharp.TypeManager.IsEqual (System.Type a, System.Type b) [0x00000] 
  at Mono.CSharp.Struct.IsUnmanagedType () [0x00000] 
  at Mono.CSharp.TypeManager.IsUnmanagedType (System.Type t) [0x00000] 
  at Mono.CSharp.Struct.IsUnmanagedType () [0x00000] 
  at Mono.CSharp.TypeManager.IsUnmanagedType (System.Type t) [0x00000] 
  at Mono.CSharp.Struct.IsUnmanagedType () [0x00000] 
  at Mono.CSharp.TypeManager.IsUnmanagedType (System.Type t) [0x00000] 
[...]
  at Mono.CSharp.Struct.IsUnmanagedType () [0x00000] 
  at Mono.CSharp.TypeManager.IsUnmanagedType (System.Type t) [0x00000] 
  --- End of inner exception stack trace ---
  at Mono.CSharp.RootContext.PopulateTypes () [0x00000] 
  at Mono.CSharp.Driver.Compile () [0x00000] 
  at Mono.CSharp.Driver.Main (System.String[] args) [0x00000] 
--- cut ---

It breaks compilation of the mono stuff in OpenOffice_org in openSUSE-Factory.
Comment 1 Stephan Kulow 2009-04-15 13:05:46 UTC
we need to have this pretty badly.
Comment 2 Petr Mladek 2009-04-28 10:35:24 UTC
Created attachment 288567 [details]
Workaround to build OOo with the broken mono.

I am not sure if it works then, though.

It would be really nice to provide the right fix in mono.
Comment 3 Petr Mladek 2009-05-07 15:30:55 UTC
It seems to be a duplicate of the bug #471379.
Comment 4 Marek Safar 2009-05-07 18:00:57 UTC
Duplicate.

*** This bug has been marked as a duplicate of bug 471379 ***
Comment 5 Marek Safar 2009-06-01 10:16:47 UTC
*** Bug 508576 has been marked as a duplicate of this bug. ***