[Mono-bugs] [Bug 421101] New: C# Compiler bad behavior with (unsafe) pointers

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Thu Aug 28 10:55:51 EDT 2008


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


           Summary: C# Compiler bad behavior with (unsafe) pointers
           Product: Mono: Compilers
           Version: unspecified
          Platform: i386
        OS/Version: Ubuntu
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: francois.trahan at gmail.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: Component Test


At this time, I don't remember that much if this has appened with version 1.9
or 2.0... sorry

Inside a struct, I have the following fields : 

public word nData;
public fixed byte Data[350];

The following code won't compile (and it should... it actually works perfect in
Visual Studio...)

//[...]
fixed (byte* bP = Data)
{
        stDataSubPacket* p = (stDataSubPacket*) bP;
        for (int i = 0; i != nData; ++i)
        {
               //[...]
/*ERROR*/      p = (stDataSubPacket*) (p->Data + p->nData);
        }
}

I get the following exception : 
"You cannot use fixed size buffers contained in unfixed expressions. Try using
the fixed statement(CS1666)"

Unfortunately, "p" and everything where it points at IS fixed memory.


-- 
Configure bugmail: https://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