Package: mono-mcs Version: 3.0.6+dfsg2-4 Severity: normal File: /usr/bin/mcs
Dear Maintainer, It seems mcs generates IL that simply does not make sense (and differs to what Visual Studio generates) for the following source code: using System; namespace PHP { public struct FullPath { private string path; public FullPath(string arbitraryPath) { this.path = arbitraryPath; } public static implicit operator string(FullPath fullPath) { return fullPath.path; } } class FullPathTest { public static void Main (string[] args) { FullPath fp = new FullPath ("/etc/passwd"); Console.WriteLine ("Comparing with == : " + (fp == null ? "true" : "false") + "; expected: false"); Console.WriteLine ("Comparing with != : " +(fp != null ? "true" : "false") + "; expected: true"); Console.WriteLine (); } } } Here's a snippet of monodis output for assembly generated with mono compiler: IL_000c: ldstr "Comparing with == : " IL_0011: ldloc.0 IL_0012: call string valuetype PHP.FullPath::op_Implicit(valuetype PHP.FullPath) IL_0017: ldloc.0 // should be ldnull (!) IL_0018: call string valuetype PHP.FullPath::op_Implicit(valuetype PHP.FullPath) // this line should not be present at all IL_001d: call bool string::op_Equality(string, string) IL_0022: brfalse IL_0031 IL_0027: ldstr "true" IL_002c: br IL_0036 IL_0031: ldstr "false" IL_0036: ldstr "; expected: false" IL_003b: call string string::Concat(string, string, string) IL_0040: call void class [mscorlib]System.Console::WriteLine(string) Here's what Visual Studio 2012 Express generates: IL_000e: ldstr "Comparing with == : " IL_0013: ldloc.0 IL_0014: call string valuetype PHP.FullPath::op_Implicit(valuetype PHP.FullPath) IL_0019: ldnull IL_001a: call bool string::op_Equality(string, string) IL_001f: brtrue.s IL_0028 IL_0021: ldstr "false" IL_0026: br.s IL_002d IL_0028: ldstr "true" IL_002d: nop IL_002e: ldstr "; expected: false" IL_0033: call string string::Concat(string, string, string) IL_0038: call void class [mscorlib]System.Console::WriteLine(string) As a result of this, program compiled with mono csharp compiler produces totally unexpected results. -- System Information: Debian Release: jessie/sid APT prefers unstable APT policy: (500, 'unstable') Architecture: i386 (i686) Kernel: Linux 3.8-2-686-pae (SMP w/1 CPU core) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages mono-mcs depends on: ii libc6 2.17-3 ii libmono-corlib4.5-cil 3.0.6+dfsg2-4 ii libmono-microsoft-csharp4.0-cil 3.0.6+dfsg2-4 ii libmono-system-core4.0-cil 3.0.6+dfsg2-4 ii libmono-system-xml4.0-cil 3.0.6+dfsg2-4 ii libmono-system4.0-cil 3.0.6+dfsg2-4 ii mono-runtime 3.0.6+dfsg2-4 Versions of packages mono-mcs recommends: ii pkg-config 0.26-1 mono-mcs suggests no packages. -- no debconf information -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org