[Mono-bugs] [Bug 76133][Maj] New - Fixed statement error within
unsafe code
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Sat Sep 17 03:13:30 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 rastaman at ceejs.com.
http://bugzilla.ximian.com/show_bug.cgi?id=76133
--- shadow/76133 2005-09-17 03:13:30.000000000 -0400
+++ shadow/76133.tmp.1775 2005-09-17 03:13:30.000000000 -0400
@@ -0,0 +1,104 @@
+Bug#: 76133
+Product: Mono: Compilers
+Version: 1.1
+OS:
+OS Details: Ubuntu 5.04
+Status: NEW
+Resolution:
+Severity:
+Priority: Major
+Component: C#
+AssignedTo: rharinath at novell.com
+ReportedBy: rastaman at ceejs.com
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Fixed statement error within unsafe code
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+
+
+Steps to reproduce the problem:
+compile this code with "mcs -unsafe test.fixed.cs" and i get this error:
+test.fixed.cs(24,22): error CS0213: You cannot use the fixed statement to
+take the address of an already fixed expression
+Compilation failed: 1 error(s), 0 warnings
+
+I compiled it with csc on windows "csc /unsafe test.fixed.cs" and no errors
+ it runs and outputs the correct output:
+ col(0) = ( 1.1, 2.1, 3.1 )
+ col(1) = ( 1.2, 2.2, 3.2 )
+ col(2) = ( 1.3, 2.3, 3.3 )
+
+
+
+-- file test.fixed.cs --
+using System;
+
+public struct Vector3
+{
+ public float x,y,z;
+ public Vector3(float _x, float _y, float _z)
+ {
+ x = _x;
+ y = _y;
+ z = _z;
+ }
+}
+
+public struct Matrix3
+{
+ public float m00, m01, m02;
+ public float m10, m11, m12;
+ public float m20, m21, m22;
+
+ public Vector3 GetColumn(int col)
+ {
+ unsafe
+ {
+ fixed(float* pM = &m00)
+ {
+ return new Vector3( *(pM + col), //m[0,col],
+ *(pM + 3 + col), //m[1,col],
+ *(pM + 6 + col)); //m[2,col]);
+ }
+ }
+ }
+
+ public static void Main ()
+ {
+ Matrix3 m = new Matrix3();
+ m.m00 = 1.1f;
+ m.m01 = 1.2f;
+ m.m02 = 1.3f;
+
+ m.m10 = 2.1f;
+ m.m11 = 2.2f;
+ m.m12 = 2.3f;
+
+ m.m20 = 3.1f;
+ m.m21 = 3.2f;
+ m.m22 = 3.3f;
+
+ for (int i=0; i<3; i++)
+ {
+ Vector3 v = m.GetColumn( i );
+ Console.WriteLine(" col({0}) = ( {1}, {2}, {3} ) " , i, v.x, v.y, v.z );
+ }
+ }
+}
+-- test.fixed.cs --
+
+Actual Results:
+
+
+Expected Results:
+
+
+How often does this happen?
+
+
+Additional Information:
More information about the mono-bugs
mailing list