[Mono-devel-list] Two mcs unsafe code bugs

Jeroen Frijters jeroen at sumatra.nl
Fri Aug 27 05:48:53 EDT 2004


Hi,

I found two small bugs in mcs when dealing with unsafe code.

In Method1 mcs complains about the second local variable p and in
Method2 in wants me to use a fixed block, but since MyStruct* p is
already an unmanaged pointer that doesn't make sense.

Regards,
Jeroen

>>> unsafe.cs <<<
using System.Runtime.InteropServices;

struct MyStruct
{
  internal int p;
}

class test
{
  int bar;

  unsafe void Method1()
  {
    fixed(void* p = &bar) {}
    fixed(void* p = &bar) {}
  }

  unsafe void Method2(MyStruct* p)
  {
    void* pv = &p->p;
  }
}



More information about the Mono-devel-list mailing list