[Mono-bugs] [Bug 75156][Nor] New - [GMCS] miscompiles 'is' statement

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sat Jun 4 13:21:20 EDT 2005


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 vargaz at gmail.com.

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

--- shadow/75156	2005-06-04 13:21:20.000000000 -0400
+++ shadow/75156.tmp.6203	2005-06-04 13:21:20.000000000 -0400
@@ -0,0 +1,54 @@
+Bug#: 75156
+Product: Mono: Compilers
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: C#
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: vargaz at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: [GMCS] miscompiles 'is' statement
+
+Testcase:
+
+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+using System;
+using System.Reflection;
+
+public class Tests {
+
+	public void GetName (MethodBase method, out object retType) {
+		retType = method is ConstructorInfo ? new Object () : new Object ();
+	}
+
+	public static void Main () {
+		object o;
+		new Tests ().GetName (typeof (Tests).GetMethod ("Main"), out o);
+	}
+}
+<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
+
+When compiling this with gmcs, it prints:
+
+uj.cs(7) warning CS0184: The given expression is never of the provided
+('System.Nullable`1') type
+
+also, the generated IL looks doesn't contain an isinst instruction at all:
+
+       .maxstack 8
+        IL_0000:  ldarg.2
+        IL_0001:  br IL_0010
+
+        IL_0006:  newobj instance void object::.ctor()
+        IL_000b:  br IL_0015
+
+        IL_0010:  newobj instance void object::.ctor()
+        IL_0015:  stind.ref
+        IL_0016:  ret


More information about the mono-bugs mailing list