https://bugzilla.novell.com/show_bug.cgi?id=389138


           Summary: C# compiler code fails when running under .NET Framework
           Product: Mono: Compilers
           Version: 1.9.0
          Platform: x86
        OS/Version: Windows Vista
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: C#
        AssignedTo: [email protected]
        ReportedBy: [EMAIL PROTECTED]
         QAContact: [email protected]
          Found By: Other


support.cs, line 385

CharArrayHashtable.GetHash(object key)

throws an OverflowException when called from Tokenizer.InitTokens method with
parameters "abstract", Token.ABSTRACT (cs-tokenizer.cs line 303).

I am using the project **gmcs.csproj** to build the Mono C# compiler.


The cause of failure is overflow when calculating the hash. The simplest way to
fix is to add 'unchecked' keyword to line 385 of support.cs:

                protected override int GetHash (Object key)
                {
                        char[] arr = (char[])key;
                        int h = 0;

                        for (int i = 0; i < len; ++i)
                                h = unchecked((h << 5) - h + arr [i]);

                        return h;
                }


I think the difference between Microsoft's .NET and Mono here is the defaulting
to unchecked in Mono. Nevertheless, for a compatibility it should default to
same. But for a quick fix, explicit 'unchecked' keyword can be used to satisfy
both worlds.


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.
_______________________________________________
mono-bugs maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-bugs

Reply via email to