[Mono-list] Possible JIT bug
Mike Welham
mike@digitalnova.co.za
Wed, 19 Jan 2005 08:51:54 +0200
Good day,
Thank you Mono-Team for your excellent work.
I've been working with multidimensional arrays and have run into some
code that compiles fine with both mcs and Microsoft's C# compiler, runs
fine in Microsoft's runtime and with mint, but throws a
NullReferenceException with mono.=20
(I'm not sure the problem is tied to multidimensional arrays - it's just
that it is the only place that I've managed to replicate it.)
The code below demonstrates the problem. The commented-out (functionally
equivalent) version in the sample runs fine.
More info that I hope will help: Mono 1.0.5 on WinXP SP2 x86. The
assembly verifies fine with Microsoft's PEVerify.=20
Sorry that I can't get to a Linux box right now to test this against svn
head.
<sample>
using System;
class Host=20
{
public static void Main()=20
{
int[,] a =3D new int[4,4];
for(int i =3D 0; i < 4; ++i)
{
for(int j =3D 0; j < 4; ++j)
{
a[i, j] =3D i + j;
}
}
int[,] b =3D new int[4,4];
for(int i =3D 0; i < 4; ++i)
{
for(int j =3D 0; j < 4; ++j)
{
// NullReferenceException thrown here:
b[i,j] =3D a[0,(i + j) % 4];
// This (equivalent) code works fine:
// int c =3D (i + j) % 4;
// b[i,j] =3D a[0,c];
}
}
}
}
</sample>
Best Regards,
Mike