[Mono-bugs] [Bug 434620] Structure Corruption

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sun Oct 12 19:24:43 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=434620

User jmichels at bluefintrading.com added comment
https://bugzilla.novell.com/show_bug.cgi?id=434620#c1





--- Comment #1 from James Michels <jmichels at bluefintrading.com>  2008-10-12 17:24:43 MDT ---
*** Adding simpler test case ***
*** Reminder this is for 64 bit arch ***

using System;
class Test
{
    struct Vertex
    {
        public float x;
        public float y;
        public float z;

        public override string ToString()
        {
            return string.Format("Vertex={0},{1},{2}", x, y, z); 
        }
    }

    enum TestEnum
        {
            one,
            two,
            three
        }

    struct S
    {
        public TestEnum tE;
        public Vertex v;
        public int A;
        public int B;
        public int C;

        public S(S s)
        {
            tE = s.tE;
            v = s.v;                    
            A = s.A;
            B = s.B;
            C = s.C;
        }

        public override string ToString()
        {
            return string.Format("TestEnum={0} {1} A={2} B={3} C={4}", tE, v,
A, B, C);
        }
    }

    static void Main(string[] args)
    {
        S s = new S();
        s.A = 1;
        s.B = 2;
        s.C = 3;
        S s2 = new S(s);
        Console.WriteLine(s);
        Console.WriteLine(s2);
    }
}

Yields the following output

TestEnum=one Vertex=0,0,0 A=1 B=2 C=3
TestEnum=1880325640 Vertex=0,0,0 A=0 B=1 C=2


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


More information about the mono-bugs mailing list