https://bugzilla.novell.com/show_bug.cgi?id=431827
Summary: Addition with int and pointer generates wrong bytecode
Product: Mono: Compilers
Version: 2.0
Platform: Other
OS/Version: Other
Status: NEW
Severity: Normal
Priority: P5 - None
Component: C#
AssignedTo: [EMAIL PROTECTED]
ReportedBy: [EMAIL PROTECTED]
QAContact: [email protected]
Found By: ---
The following code:
public unsafe class TheClass
{
public unsafe byte* GetFoo () {
byte *one = null;
return 9 + one;
}
}
produces:
.locals init (
unsigned int8* V_0)
IL_0000: ldc.i4.0
IL_0001: conv.u
IL_0002: stloc.0
IL_0003: ldc.i4.s 0x09
IL_0005: ldloc.0
IL_0006: ldc.i4.4
IL_0007: mul
IL_0008: add
IL_0009: ret
Mono.CSharp.PointerArithmetic assumes the left operand is always a pointer, and
in this case it's not, so it ends up casting the int to a byte* and then
multiplying the pointer by 4 to compensate :P
This is actually a regression, 1.2.6 compiles correctly, and I'm thinking 1.9
does too (didn'test yet though)
--
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
_______________________________________________
mono-bugs maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs