[Mono-bugs] [Bug 40786][Nor] New - Unsafe Code Will Not Compile on MCS
bugzilla-daemon@rocky.ximian.com
bugzilla-daemon@rocky.ximian.com
Fri, 4 Apr 2003 14:37:14 -0500 (EST)
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 webmaster@theratnerschool.org.
http://bugzilla.ximian.com/show_bug.cgi?id=40786
--- shadow/40786 Fri Apr 4 14:37:14 2003
+++ shadow/40786.tmp.19918 Fri Apr 4 14:37:14 2003
@@ -0,0 +1,79 @@
+Bug#: 40786
+Product: Mono/MCS
+Version: unspecified
+OS: All
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: Misc
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: webmaster@theratnerschool.org
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Unsafe Code Will Not Compile on MCS
+
+Description of Problem:
+When I compile the below code on mcs, it does not compile, but on csc it
+does.
+
+using System;
+class Test {
+
+ public struct BigInteger {
+ public uint[] data;
+ public uint length;
+ }
+ public static unsafe BigInteger Reduce( BigInteger n, BigInteger
+m, uint mPrime ) {
+ BigInteger A = n;
+ fixed (uint* a = A.data, mm = m.data) {
+ for (uint i = 0; i < m.length; i++) {
+ uint u_i = a[0] * mPrime;
+ uint* mP = mm, aSP = a, aDP = a;
+ ulong c = (ulong)u_i * (ulong)*(mP++) + *
+(aSP++);
+ }
+ }
+
+ return A;
+ }
+}
+
+
+Steps to reproduce the problem:
+1. Compile code above using the -unsafe flag
+
+Actual Results:
+error CS0122: `System.UInt32*' is inaccessible because of its protection
+level
+error CS0122: `System.UInt32*' is inaccessible because of its protection
+level
+error CS0122: `System.UInt32*' is inaccessible because of its protection
+level
+error CS0122: `System.UInt32*' is inaccessible because of its protection
+level
+error CS0122: `System.UInt32*' is inaccessible because of its protection
+level
+test.cs(8) error CS0161: Not all code paths return a value
+Compilation failed: 6 error(s), 0 warnings
+
+Expected Results:
+With csc you get:
+
+test.cs(5,17): warning CS0649: Field 'Test.BigInteger.data' is never
+assigned
+ to, and will always have its default value null
+test.cs(6,15): warning CS0649: Field 'Test.BigInteger.length' is never
+assigned
+ to, and will always have its default value 0
+
+
+How often does this happen?
+All the time
+
+Additional Information:
+This code was taken from some BigInteger code and simplified for this bug