[Mono-bugs] [Bug 43687][Nor] Changed - incorrect code when using null where a pointer is expected

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Tue, 27 May 2003 04:46:42 -0400 (EDT)


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 lupus@ximian.com.

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

--- shadow/43687	Tue May 27 04:11:48 2003
+++ shadow/43687.tmp.1671	Tue May 27 04:46:42 2003
@@ -1,23 +1,23 @@
 Bug#: 43687
-Product: Mono/Runtime
+Product: Mono/MCS
 Version: unspecified
 OS: unknown
 OS Details: 
 Status: NEW   
 Resolution: 
 Severity: Unknown
 Priority: Normal
-Component: misc
+Component: Misc
 AssignedTo: mono-bugs@ximian.com                            
 ReportedBy: miguel@ximian.com               
 QAContact: mono-bugs@ximian.com
 TargetMilestone: ---
 URL: 
 Cc: 
-Summary: void * in P/Invoke signature causes runtime to abort.
+Summary: incorrect code when using null where a pointer is expected
 
 The following program makes the runtime abort while compiling the method:
 
 using System;
 using System.Runtime.InteropServices;
 
@@ -34,6 +34,18 @@
 
 ------- Additional Comments From miguel@ximian.com  2003-05-26 20:17 -------
 In fact this happens with other pointer types as well.
 
 ------- Additional Comments From dietmar@ximian.com  2003-05-27 04:11 -------
 This is caused by the call to check_call_signature() in mini.c line 2926
+
+------- Additional Comments From lupus@ximian.com  2003-05-27 04:46 -------
+I made mini allow the construct, since the MS runtime accepts it.
+There is still a mcs issue, though: when using null where a pointer is
+expected, csc correctly uses:
+  ldc.i4.0
+  conv.u
+instead of the broken ldnull mcs produces.
+I would also hope that kind of code to be removed from our sources,
+since it is exceptionally ugly: using IntPtr as the argument type and
+IntPtr.Zero instead of null would make for cleaner code and not
+require the use of /unsafe.