[Mono-bugs] [Bug 61702][Maj] New - mcs crash with a block of code I try to compile
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Sun, 18 Jul 2004 10:40:32 -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 mikko.korkalo@f-solutions.net.
http://bugzilla.ximian.com/show_bug.cgi?id=61702
--- shadow/61702 2004-07-18 10:40:31.000000000 -0400
+++ shadow/61702.tmp.20008 2004-07-18 10:40:31.000000000 -0400
@@ -0,0 +1,105 @@
+Bug#: 61702
+Product: Mono: Compilers
+Version: unspecified
+OS: All
+OS Details: Windows 2000 SP4, mono 1.0
+Status: NEW
+Resolution:
+Severity:
+Priority: Major
+Component: C#
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: mikko.korkalo@f-solutions.net
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: mcs crash with a block of code I try to compile
+
+Description of Problem:
+mcs crash with a block of code I try to compile.
+
+
+Steps to reproduce the problem:
+
+--- compile the following function ---
+
+public static string RandomLetters(short count)
+{
+ // generates random lowercase letters given count
+ byte[] bytes;
+ bytes = new byte[count];
+ System.Security.Cryptography.RandomNumberGenerator rnd = System.
+Security.Cryptography.RandomNumberGenerator.Create();
+ rnd.GetBytes(bytes);
+
+ const byte min=97; // ascii range: 97 (a) - 122 (z)
+ const byte max=122;
+ const byte range = max - min + 1;
+ const float rangefactor = ((float) range) / 255; // letter ascii code
+range (~28) against 0 - 255 -> 0,something
+
+ byte[] newbytes = new byte[count];
+
+ for (byte k=0;k<bytes.Length;k++)
+ {
+ newbytes[k] = System.Convert.ToByte(((((float) bytes[k]) * rangefactor)
++ (float) min));
+ }
+ string str = System.Text.ASCIIEncoding.ASCII.GetString(newbytes,0,
+newbytes.Length);
+ Debug.WriteLine("RandomLetters() returning '" + str + "'");
+ return str;
+}
+
+--- End of function ---
+
+
+
+
+Actual Results:
+
+--- compiler crash with message as follows ---
+
+Exception caught by the compiler while compiling:
+ Block that caused the problem begin at: G:
+\code\csharp\keitsibot\keitsibot\Common.cs: (13)
+ Block being compiled: [Internal: (1),Internal: (1)]
+System.Exception: Expression Mono.CSharp.Binary ExprClass is Invalid after
+resolve
+ in Expression.Resolve (Mono.CSharp.EmitContext, Mono.CSharp.ResolveFlags)
+ in Expression.Resolve (Mono.CSharp.EmitContext)
+ in SimpleName.DoSimpleNameResolve (Mono.CSharp.EmitContext, Mono.CSharp.
+Expression, bool, bool)
+ in SimpleName.SimpleNameResolve (Mono.CSharp.EmitContext, Mono.CSharp.
+Expression, bool, bool)
+ in SimpleName.DoResolveAllowStatic (Mono.CSharp.EmitContext, bool)
+ in Expression.Resolve (Mono.CSharp.EmitContext, Mono.CSharp.ResolveFlags)
+ in Expression.Resolve (Mono.CSharp.EmitContext)
+ in Cast.DoResolve (Mono.CSharp.EmitContext)
+ in Expression.Resolve (Mono.CSharp.EmitContext, Mono.CSharp.ResolveFlags)
+ in Expression.Resolve (Mono.CSharp.EmitContext)
+ in Binary.DoResolve (Mono.CSharp.EmitContext)
+ in Expression.Resolve (Mono.CSharp.EmitContext, Mono.CSharp.ResolveFlags)
+ in Expression.Resolve (Mono.CSharp.EmitContext)
+ in Block.EmitMeta (Mono.CSharp.EmitContext, Mono.CSharp.
+InternalParameters)
+ in Block.EmitMeta (Mono.CSharp.EmitContext, Mono.CSharp.
+InternalParameters)
+ in Block.EmitMeta (Mono.CSharp.EmitContext, Mono.CSharp.
+InternalParameters)
+ in EmitContext.EmitTopBlock (Mono.CSharp.Block, Mono.CSharp.
+InternalParameters, Mono.CSharp.Location)
+
+--- end of compiler crash ---
+
+
+Expected Results:
+Compiles on MS .NET framework 1.1.
+
+How often does this happen?
+Every time I try to compile
+
+Additional Information:
+System.Security.Cryptography.RandomNumberGenerator does not seem to cause
+it. Seems like this has something to do with the constants I am using.