[Mono-bugs] [Bug 36030][Nor] Changed - Weird array access problem in unsafe contexts

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
27 Dec 2002 01:49:19 -0000


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by ravi@ximian.com.

http://bugzilla.ximian.com/show_bug.cgi?id=36030

--- shadow/36030	Sun Dec 22 13:42:16 2002
+++ shadow/36030.tmp.29951	Thu Dec 26 20:49:19 2002
@@ -39,6 +39,64 @@
                         return 0;
                 }
         }
 }
 
 It seems like there is some bug in the array access code. Happens everytime
+
+------- Additional Comments From ravi@ximian.com  2002-12-26 20:49 -------
+Here's an update which makes me more confused than ever :
+
+1. The IL generated by csc and mcs are quite different. I am not 
+sure why this is the case.
+
+2. PEVerify produces lots of errors with the csc generated code :
+
+[IL]: Error: [c:\cygwin\home\ravi\mcs\bugzilla-bugs\bug.exe : 
+IntPtr_Conv.Class1::Main] [local variable #0x00000001] 
+ELEMENT_TYPE_PTR can not be verified.
+[IL]: Error: [c:\cygwin\home\ravi\mcs\bugzilla-bugs\bug.exe : 
+IntPtr_Conv.Class1::Main] [offset 0x00000007] [opcode ldloc.3] 
+initlocals must be set for verifiable methods with one or more local 
+variables.
+[IL]: Error: [c:\cygwin\home\ravi\mcs\bugzilla-bugs\bug.exe : 
+IntPtr_Conv.Class1::Main] [offset 0x00000018] [opcode ldloc.3] 
+initlocals must be set for verifiable methods with one or more local 
+variables.
+[IL]: Error: [c:\cygwin\home\ravi\mcs\bugzilla-bugs\bug.exe : 
+IntPtr_Conv.Class1::Main] [offset 0x0000001A] [opcode ldloc.0] 
+initlocals must be set for verifiable methods with one or more local 
+variables.
+[IL]: Error: [c:\cygwin\home\ravi\mcs\bugzilla-bugs\bug.exe : 
+IntPtr_Conv.Class1::Main] [offset 0x00000026]  [return sig] 
+ELEMENT_TYPE_PTR can not be verified.
+[IL]: Error: [c:\cygwin\home\ravi\mcs\bugzilla-bugs\bug.exe : 
+IntPtr_Conv.Class1::Main] [offset 0x0000002B] [opcode stloc.1] 
+[found address of void] [expected address of value 
+class 'IntPtr_Conv.FooStruct'] Unexpected type on the stack.
+[IL]: Error: [c:\cygwin\home\ravi\mcs\bugzilla-bugs\bug.exe : 
+IntPtr_Conv.Class1::Main] [offset 0x0000002B] [opcode stloc.1] 
+[found address of void] [expected address of value 
+class 'IntPtr_Conv.FooStruct'] Unexpected type on the stack.
+[IL]: Error: [c:\cygwin\home\ravi\mcs\bugzilla-bugs\bug.exe : 
+IntPtr_Conv.Class1::Main] [offset 0x00000030] [opcode ldloc.2] 
+initlocals must be set for verifiable methods with one or more local 
+variables.
+
+And only the following mcs generated code :
+
+[IL]: Error: [c:\cygwin\home\ravi\mcs\bugzilla-bugs\bug.exe : 
+IntPtr_Conv.Class1::Main] [local variable #0x00000001] 
+ELEMENT_TYPE_PTR can not be verified.
+[IL]: Error: [c:\cygwin\home\ravi\mcs\bugzilla-bugs\bug.exe : 
+IntPtr_Conv.Class1::Main] [offset 0x00000013] [opcode stelem.i] 
+Stack underflow.
+[IL]: Error: [c:\cygwin\home\ravi\mcs\bugzilla-bugs\bug.exe : 
+IntPtr_Conv.Class1::Main]  [HRESULT 0x80004005] - Unspecified error
+
+
+The interesting thing is that inspite of those errors, the .NET 
+runtime actually runs bug.exe fine when compiled with csc but throws 
+an exception with the mcs-generated one.
+
+This needs some more investigation. I am leaving for India tomorrow 
+so I shall continue working on this after I reach.