[Mono-list] mcs bug, chokes on multidimensional array

Tomar tomar@apricot.com
Sun, 15 Aug 2004 11:06:42 -0500


--=-a7N/pWfMwUfXz5OjeWGn
Content-Type: text/plain
Content-Transfer-Encoding: quoted-printable

This appears to be a mcs specific "bug".  Mono itself seems to handle
the il from jagged arrays just fine.

The problem itself appears to be something with the way jagged arrays
are used "behind the scenes".  The compilers in both cases will generate
the il for "mb" as a type "int32[,][]".  This would follow that the
error from mcs is somewhat correct: casting a "int32[,][]" to a
"int32[][,]" is not possible.  The csc compiler just appears to ignore
the cast (or realize its unnecessary since its "same type" to "same
type" casting?) and just does a "ldloc.0/stloc.0" while the mcs compiler
tries to generate a cast which fails if done explicitly.

As an aside, I hate the use of jagged arrays. :-)

Tom Larsen

On Sat, 2004-08-14 at 10:06, Antony Lesuisse wrote:
> I think i've found a bug in mcs 1.0, confirmed by checking in vs.net.
> Here is the test:
>=20
> /*
> VS.NET:
>     OK
>=20
> Mono C# compiler version 1.0.0.0 (from debian package):
>     mcs: tmp.cs(28) error CS0030: Cannot convert type 'int[,][]' to 'int[=
][,]'
>=20
> */
>=20
> using System;
> class ArrayBug {
>     public static int Main(String[] args) {
>         int[][,] mb =3D new int[3][,];
>         mb =3D (int[][,])mb;
>         return 0;
>     }
> }
--=20
Tomar <tomar@apricot.com>

--=-a7N/pWfMwUfXz5OjeWGn
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQBBH4oQKaYNoZecAvQRAoT9AJ0VPUmRoZr/TC9lpSCjI78qPJumWwCcCRVS
DAyvBSPQjF15XXg232B+sjE=
=V4ds
-----END PGP SIGNATURE-----

--=-a7N/pWfMwUfXz5OjeWGn--