[Mono-bugs] [Bug 372483] New: Conversion instruction called twice for compound operator /assignment
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Wed Mar 19 14:01:28 EDT 2008
https://bugzilla.novell.com/show_bug.cgi?id=372483
Summary: Conversion instruction called twice for compound
operator/assignment
Product: Mono: Compilers
Version: 1.9.0
Platform: i686
OS/Version: Linux
Status: NEW
Severity: Normal
Priority: P5 - None
Component: C#
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: sleibman at interactivesupercomputing.com
QAContact: mono-bugs at lists.ximian.com
Found By: Customer
In mono 1.9 [using gmcs on Linux (kernel 2.6.22-14-generic, i686)], if I write
code that includes an implicit cast in conjunction with a compound operator
(e.g. *=, +=, etc.), it compiles successfully, but at runtime the virtual
machine dies with a SIGABRT. This is not a problem with previous mono releases.
It appears to be due to an incorrectly generated CIL instruction.
Code to reproduce this behavior (along with additional explanations in the
comments) is shown below.
Please feel free to contact me if you need additional information.
Thanks,
Steve Leibman
sleibman at interactivesupercomputing.com
using System;
using SizeType = System.UInt64;
public class broken_cast
{
public static void Main()
{
SizeType m = 1;
SizeType i = 1;
SizeType[] n = new SizeType[2] {7, 8};
// In mono 1.9 (but not 1.2.6), the following line will cause
// the program to abort with following error at runtime:
// ** ERROR **: unknown operator: conv.ovf.i.un
// If I use monodis to look at the CIL code, it appears that
// this problem is due to the fact that the conversion operator
// to cast i from uint64 to int gets called twice.
m *= n[i];
// Interestingly, the following line works fine (in both 1.9 and
// 1.2.6), and in the CIL code, I see that conv.ovf.i.un is only
// called once:
m = m * n[i];
// The following also works fine in both versions (and technically,
// I suppose, is the way a C# programmer is supposed to do it,
// since the indexing operator is defined to only accept
// variables of type int):
m *= n[(int)i];
}
}
--
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