[Mono-bugs] [Bug 46719][Min] New - invalid use of address-of operator causes exception in MCS

bugzilla-daemon@rocky.ximian.com bugzilla-daemon@rocky.ximian.com
Tue, 22 Jul 2003 10:36:06 -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 vargaz@freemail.hu.


--- shadow/46719	Tue Jul 22 10:36:06 2003
+++ shadow/46719.tmp.11033	Tue Jul 22 10:36:06 2003
@@ -0,0 +1,73 @@
+Bug#: 46719
+Product: Mono/MCS
+Version: unspecified
+OS: Debian Woody
+OS Details: 
+Status: NEW   
+Priority: Minor
+Component: Misc
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: vargaz@freemail.hu               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+Summary: invalid use of address-of operator causes exception in MCS
+Compiling the following (invalid)program causes an exception inside MCS:
+using System;
+using System.Collections;
+using System.Text;
+using System.Reflection;
+using System.Runtime.InteropServices;
+using System.Threading;
+public unsafe struct AStruct {
+	public int i;
+	public void Enter () {
+		void *current = &i;
+	}
+        public static void Main (String[] args) {
+        }
+CSC reports this:
+bug-mcs-fixed.cs(16,19): error CS0212: You can only take the address of unfixed
+expression inside of a fixed statement initializer
+while MCS crashes with the following stack trace:
+Exception caught by the compiler while compiling:
+   Block that caused the problem begin at: bug-mcs-fixed.cs: (15)
+                     Block being compiled: [bug-mcs-fixed.cs:
+(15),bug-mcs-fixed.cs: (17)]
+Unhandled Exception: System.NullReferenceException: A null value was found
+where an object instance was required
+in [0x00006] (at /home/zovarga/mono-cvs/mcs/mcs/expression.cs:6072) 00
+Mono.CSharp.This:VerifyFixed (bool)
+in [0x00014] (at /home/zovarga/mono-cvs/mcs/mcs/ecore.cs:2520) 00
+Mono.CSharp.FieldExpr:VerifyFixed (bool)
+in [0x00287] (at /home/zovarga/mono-cvs/mcs/mcs/expression.cs:406) 00
+Mono.CSharp.Unary:ResolveOperator (Mono.CSharp.EmitContext)
+in [0x00050] (at /home/zovarga/mono-cvs/mcs/mcs/expression.cs:541) 00
+Mono.CSharp.Unary:DoResolve (Mono.CSharp.EmitContext)
+in [0x0004c] (at /home/zovarga/mono-cvs/mcs/mcs/ecore.cs:288) 00
+in [0x00003] (at /home/zovarga/mono-cvs/mcs/mcs/ecore.cs:365) 00
+Mono.CSharp.Expression:Resolve (Mono.CSharp.EmitContext)
+in [0x00046] (at /home/zovarga/mono-cvs/mcs/mcs/assign.cs:171) 00
+Mono.CSharp.Assign:DoResolve (Mono.CSharp.EmitContext)
+in [0x0004c] (at /home/zovarga/mono-cvs/mcs/mcs/ecore.cs:288) 00