[Mono-bugs] [Bug 479506] New: Out of range exceptions with object initializers
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Wed Feb 25 07:43:49 EST 2009
https://bugzilla.novell.com/show_bug.cgi?id=479506
Summary: Out of range exceptions with object initializers
Classification: Mono
Product: Mono: Compilers
Version: 2.2.x
Platform: x86-64
OS/Version: Linux
Status: NEW
Severity: Normal
Priority: P5 - None
Component: C#
AssignedTo: mono-bugs at lists.ximian.com
ReportedBy: stapostol at gmail.com
QAContact: mono-bugs at lists.ximian.com
Found By: ---
Created an attachment (id=275328)
--> (https://bugzilla.novell.com/attachment.cgi?id=275328)
Simple project that reproduces the issue.
User-Agent: Opera/9.63 (X11; Linux x86_64; U; el) Presto/2.1.1
The easiest way to describe the problem is with a source snippet:
struct Vector2 { public float X, Y; }
struct Vertex { public Vector2 Position; }
int i = 0;
Vertex[] data = new Vertex[1];
data[i++] = new Vertex() { Position = new Vector2() };
The last line causes "i" to be incremented *twice*, once before the assignment
takes places and once after, which results in an out of range exception.
Adding more fields to the structures causes "i" to be incremented more times. I
haven't been able to reproduce this with simple types (e.g. using float X, Y
instead of Vector2 in Vertex). The csc compiler does not suffer from this
issue.
I have attached a simple test case.
Any chance this can be fixed before 2.4 is released?
Reproducible: Always
Steps to Reproduce:
1. Compile and run the attached test case with gmcs - OutOfRangeException.
2. Compile and run the attached test case with csc - works.
--
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