[Mono-bugs] [Bug 394436] New: compiler crash (NRE) on some combination of generics, linq and lambda expression

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon May 26 06:18:11 EDT 2008


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


           Summary: compiler crash (NRE) on some combination of generics,
                    linq and lambda expression
           Product: Mono: Compilers
           Version: SVN
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: atsushi at ximian.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


The following generics/lambda/linq example fails:

--------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;

public class Test
{
        public static void Main ()
        {
                CompiledQuery.Compile<Enotest, IQueryable<Services>> (
                        (Enotest db) => from s in db.Services select s);
        }
}

public class Enotest
{
        public IQueryable<Services> Services { get { return null; } }
}

public class Services
{
        public int ServiceID;
}

public static class CompiledQuery
{
        public static Func<TArg0, TResult> Compile<TArg0, TResult> (
                Expression<Func<TArg0, TResult>> query)
        {
                return null;
        }
}
----
(minimized example, not for actual running.)

Actual result:

Exception caught by the compiler while emitting:
   Block that caused the problem begin at: gmcs-bug.cs(9,9):
System.NullReferenceException: Object reference not set to an instance of an
obj
ect
Internal compiler error at gmcs-bug.cs(8,28):: exception caught while emitting
M
ethodBuilder [Test::Main]

Unhandled Exception: System.NullReferenceException: Object reference not set to
an instance of an object
  at Mono.CSharp.VariableReference.EmitLoad (Mono.CSharp.EmitContext ec)
[0x0000
0]
  at Mono.CSharp.VariableReference.Emit (Mono.CSharp.EmitContext ec, Boolean
lea
ve_copy) [0x00000]
  at Mono.CSharp.VariableReference.Emit (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.TypeCast.Emit (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.Argument.Emit (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.Invocation.EmitArguments (Mono.CSharp.EmitContext ec,
System.Co
llections.ArrayList arguments, Boolean dup_args, Mono.CSharp.LocalTemporary
this
_arg) [0x00000]
  at Mono.CSharp.Invocation.EmitCall (Mono.CSharp.EmitContext ec, Boolean
is_bas
e, Mono.CSharp.Expression instance_expr, System.Reflection.MethodBase method,
Sy
stem.Collections.ArrayList Arguments, Location loc, Boolean dup_args, Boolean
om
it_args) [0x00000]
  at Mono.CSharp.Invocation.EmitCall (Mono.CSharp.EmitContext ec, Boolean
is_bas
e, Mono.CSharp.Expression instance_expr, System.Reflection.MethodBase method,
Sy
stem.Collections.ArrayList Arguments, Location loc) [0x00000]
  at Mono.CSharp.MethodGroupExpr.EmitCall (Mono.CSharp.EmitContext ec,
System.Co
llections.ArrayList arguments) [0x00000]
  at Mono.CSharp.Invocation.Emit (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.TypeCast.Emit (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.Argument.Emit (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.Invocation.EmitArguments (Mono.CSharp.EmitContext ec,
System.Co
llections.ArrayList arguments, Boolean dup_args, Mono.CSharp.LocalTemporary
this
_arg) [0x00000]
  at Mono.CSharp.Invocation.EmitCall (Mono.CSharp.EmitContext ec, Boolean
is_bas
e, Mono.CSharp.Expression instance_expr, System.Reflection.MethodBase method,
Sy
stem.Collections.ArrayList Arguments, Location loc, Boolean dup_args, Boolean
om
it_args) [0x00000]
  at Mono.CSharp.Invocation.EmitCall (Mono.CSharp.EmitContext ec, Boolean
is_bas
e, Mono.CSharp.Expression instance_expr, System.Reflection.MethodBase method,
Sy
stem.Collections.ArrayList Arguments, Location loc) [0x00000]
  at Mono.CSharp.MethodGroupExpr.EmitCall (Mono.CSharp.EmitContext ec,
System.Co
llections.ArrayList arguments) [0x00000]
  at Mono.CSharp.Invocation.Emit (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.TypeCast.Emit (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.ArrayCreation.EmitDynamicInitializers (Mono.CSharp.EmitContext
ec, Boolean emitConstants) [0x00000]
  at Mono.CSharp.ArrayCreation.Emit (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.Argument.Emit (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.Invocation.EmitArguments (Mono.CSharp.EmitContext ec,
System.Co
llections.ArrayList arguments, Boolean dup_args, Mono.CSharp.LocalTemporary
this
_arg) [0x00000]
  at Mono.CSharp.Invocation.EmitCall (Mono.CSharp.EmitContext ec, Boolean
is_bas
e, Mono.CSharp.Expression instance_expr, System.Reflection.MethodBase method,
Sy
stem.Collections.ArrayList Arguments, Location loc, Boolean dup_args, Boolean
om
it_args) [0x00000]
  at Mono.CSharp.Invocation.EmitCall (Mono.CSharp.EmitContext ec, Boolean
is_bas
e, Mono.CSharp.Expression instance_expr, System.Reflection.MethodBase method,
Sy
stem.Collections.ArrayList Arguments, Location loc) [0x00000]
  at Mono.CSharp.MethodGroupExpr.EmitCall (Mono.CSharp.EmitContext ec,
System.Co
llections.ArrayList arguments) [0x00000]
  at Mono.CSharp.Invocation.Emit (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.TypeCast.Emit (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.Argument.Emit (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.Invocation.EmitArguments (Mono.CSharp.EmitContext ec,
System.Co
llections.ArrayList arguments, Boolean dup_args, Mono.CSharp.LocalTemporary
this
_arg) [0x00000]
  at Mono.CSharp.Invocation.EmitCall (Mono.CSharp.EmitContext ec, Boolean
is_bas
e, Mono.CSharp.Expression instance_expr, System.Reflection.MethodBase method,
Sy
stem.Collections.ArrayList Arguments, Location loc, Boolean dup_args, Boolean
om
it_args) [0x00000]
  at Mono.CSharp.Invocation.EmitCall (Mono.CSharp.EmitContext ec, Boolean
is_bas
e, Mono.CSharp.Expression instance_expr, System.Reflection.MethodBase method,
Sy
stem.Collections.ArrayList Arguments, Location loc) [0x00000]
  at Mono.CSharp.MethodGroupExpr.EmitCall (Mono.CSharp.EmitContext ec,
System.Co
llections.ArrayList arguments) [0x00000]
  at Mono.CSharp.Invocation.Emit (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.Argument.Emit (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.Invocation.EmitArguments (Mono.CSharp.EmitContext ec,
System.Co
llections.ArrayList arguments, Boolean dup_args, Mono.CSharp.LocalTemporary
this
_arg) [0x00000]
  at Mono.CSharp.Invocation.EmitCall (Mono.CSharp.EmitContext ec, Boolean
is_bas
e, Mono.CSharp.Expression instance_expr, System.Reflection.MethodBase method,
Sy
stem.Collections.ArrayList Arguments, Location loc, Boolean dup_args, Boolean
om
it_args) [0x00000]
  at Mono.CSharp.Invocation.EmitCall (Mono.CSharp.EmitContext ec, Boolean
is_bas
e, Mono.CSharp.Expression instance_expr, System.Reflection.MethodBase method,
Sy
stem.Collections.ArrayList Arguments, Location loc) [0x00000]
  at Mono.CSharp.MethodGroupExpr.EmitCall (Mono.CSharp.EmitContext ec,
System.Co
llections.ArrayList arguments) [0x00000]
  at Mono.CSharp.Invocation.Emit (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.Invocation.EmitStatement (Mono.CSharp.EmitContext ec)
[0x00000]

  at Mono.CSharp.StatementExpression.DoEmit (Mono.CSharp.EmitContext ec)
[0x0000
0]
  at Mono.CSharp.Statement.Emit (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.Block.DoEmit (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.Block.Emit (Mono.CSharp.EmitContext ec) [0x00000]
  at Mono.CSharp.EmitContext.EmitResolvedTopBlock (Mono.CSharp.ToplevelBlock
blo
ck, Boolean unreachable) [0x00000]
  at Mono.CSharp.EmitContext.EmitTopBlock (IMethodData md,
Mono.CSharp.ToplevelB
lock block) [0x00000]

Expected result:
no compile error.


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