[Mono-bugs] [Bug 616031] New: gmcs generates invalid IL for gtest-166.cs

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Jun 21 13:46:03 EDT 2010


http://bugzilla.novell.com/show_bug.cgi?id=616031

http://bugzilla.novell.com/show_bug.cgi?id=616031#c0


           Summary: gmcs generates invalid IL for gtest-166.cs
    Classification: Mono
           Product: Mono: Compilers
           Version: SVN
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: vargaz at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


Testcase:
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<

// Compiler options: -unsafe -r:gtest-166-lib.dll

// Fixed buffers tests

using System;
using System.Runtime.InteropServices;

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public unsafe struct TestNew {
    private fixed char test_1 [128];
    public fixed bool test2 [4];
}

public class C {
    unsafe public static int Main () {
        TestNew tt = new TestNew ();
        tt.test2 [2] = false;

        return 0;
    }
}
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

gmcs generates the following IL:


        IL_0000:  ldloca.s 0
        IL_0002:  initobj TestNew
        IL_0008:  ldloca.s 0
        IL_000a:  ldflda valuetype TestNew/'<test2>__FixedBuffer1'
TestNew::test2
        IL_000f:  ldflda valuetype TestNew/'<test2>__FixedBuffer1'
TestNew::test2

which means the computed address will be outside the TestNew structure, leading
to random crashes at runtime.

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list