[Mono-bugs] [Bug 432367] New: Compile throws IndexOutOfRangeException on certain generic code constellation

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Sat Oct 4 17:57:44 EDT 2008


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


           Summary: Compile throws IndexOutOfRangeException on certain
                    generic code constellation
           Product: Mono: Compilers
           Version: SVN
          Platform: x86-64
        OS/Version: Linux
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: mono at e-tobi.net
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


Found in SVN Revision 114848: When compiling the following code, the compiler
throws an IndexOutOfRangeException:



public class Foo<T, U>
{
    public Bar<T> FooDoSomething<V>() where V : U
    {
        return null;
    }
}

public class Bar<T>
{
    public Foo<T, U> BarDoSomething<U>()
    {
        return null;
    }
}

public class Baz
{
    public void BazDoSomething()
    {
        Bar<string> bar = new Bar<string>();
        bar.BarDoSomething<string>().FooDoSomething<string>();
    }
}



[mono] /tmp @ mono --debug /opt/mono/lib/mono/2.0/gmcs.exe -t:library test.cs 
Exception caught by the compiler while compiling:
   Block that caused the problem begin at: test.cs(19,17):
                     Block being compiled: [test.cs(20,5):,test.cs(23,5):]
System.IndexOutOfRangeException: Array index is out of range.
Internal compiler error at test.cs(19,17):: exception caught while emitting
MethodBuilder [Baz::BazDoSomething]

Unhandled Exception: System.IndexOutOfRangeException: Array index is out of
range.
  at Mono.CSharp.ConstraintChecker.CheckConstraint (IResolveContext ec,
System.Type ptype, Mono.CSharp.Expression expr, System.Type ctype) [0x000aa] in
/home/tobias/sandbox/x/mcs/mcs/generic.cs:1610 
  at Mono.CSharp.ConstraintChecker.CheckConstraints (IResolveContext ec, Int32
index) [0x0018d] in /home/tobias/sandbox/x/mcs/mcs/generic.cs:1556 
  at Mono.CSharp.ConstraintChecker.CheckConstraints (IResolveContext ec)
[0x00007] in /home/tobias/sandbox/x/mcs/mcs/generic.cs:1479 
  at Mono.CSharp.ConstraintChecker.CheckConstraints (Mono.CSharp.EmitContext
ec, System.Reflection.MethodBase definition, System.Reflection.MethodBase
instantiated, Location loc) [0x00014] in
/home/tobias/sandbox/x/mcs/mcs/generic.cs:1697 
  at Mono.CSharp.MethodGroupExpr.OverloadResolve (Mono.CSharp.EmitContext ec,
System.Collections.ArrayList& Arguments, Boolean may_fail, Location loc)
[0x0082f] in /home/tobias/sandbox/x/mcs/mcs/ecore.cs:4459 
  at Mono.CSharp.Invocation.DoResolveOverload (Mono.CSharp.EmitContext ec)
[0x00000] in /home/tobias/sandbox/x/mcs/mcs/expression.cs:4853 
  at Mono.CSharp.Invocation.DoResolve (Mono.CSharp.EmitContext ec) [0x0013e] in
/home/tobias/sandbox/x/mcs/mcs/expression.cs:4793 
  at Mono.CSharp.Expression.Resolve (Mono.CSharp.EmitContext ec, ResolveFlags
flags) [0x00075] in /home/tobias/sandbox/x/mcs/mcs/ecore.cs:488 
  at Mono.CSharp.Expression.Resolve (Mono.CSharp.EmitContext ec) [0x00000] in
/home/tobias/sandbox/x/mcs/mcs/ecore.cs:515 
  at Mono.CSharp.ExpressionStatement.ResolveStatement (Mono.CSharp.EmitContext
ec) [0x00000] in /home/tobias/sandbox/x/mcs/mcs/ecore.cs:1319 
  at Mono.CSharp.StatementExpression.Resolve (Mono.CSharp.EmitContext ec)
[0x0000b] in /home/tobias/sandbox/x/mcs/mcs/statement.cs:743 
  at Mono.CSharp.Block.Resolve (Mono.CSharp.EmitContext ec) [0x000f0] in
/home/tobias/sandbox/x/mcs/mcs/statement.cs:2241 
  at Mono.CSharp.ExplicitBlock.Resolve (Mono.CSharp.EmitContext ec) [0x00000]
in /home/tobias/sandbox/x/mcs/mcs/statement.cs:2536 
  at Mono.CSharp.EmitContext.ResolveTopBlock (Mono.CSharp.EmitContext
anonymous_method_host, Mono.CSharp.ToplevelBlock block, Mono.CSharp.Parameters
ip, IMethodData md, System.Boolean& unreachable) [0x00087] in
/home/tobias/sandbox/x/mcs/mcs/codegen.cs:796


-- 
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.


More information about the mono-bugs mailing list