[Mono-bugs] [Bug 465253] New: nullable long / int automatic variable equality comparison generates IndexOutOfRangeException

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Jan 12 03:31:59 EST 2009


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


           Summary: nullable long / int automatic variable equality
                    comparison generates IndexOutOfRangeException
    Classification: Mono
           Product: Mono: Compilers
           Version: unspecified
          Platform: x86-64
        OS/Version: Ubuntu
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: C#
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: andres.meyer at computer.org
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---


User-Agent:       Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.0.5)
Gecko/2008121623 Ubuntu/8.10 (intrepid) Firefox/3.0.5
Build Identifier: 

the code "bool b = (5 == (long?)null);" generates an "Unhandled Exception:
System.IndexOutOfRangeException: Array index is out of range."

Reproducible: Always

Steps to Reproduce:
1. Console.WriteLine(5 == (long?)null);
2.
3.
Actual Results:  
Performing main compilation...
Exception caught by the compiler while compiling:
   Block that caused the problem begin at:
/home/ameyer/tmp/monotest/minitest/Main.cs(72,36):
                     Block being compiled:
[/home/ameyer/tmp/monotest/minitest/Main.cs(73,17):,/home/ameyer/tmp/monotest/minitest/Main.cs(139,17):]
System.IndexOutOfRangeException: Array index is out of range.
Internal compiler error at /home/ameyer/tmp/monotest/minitest/Main.cs(72,36)::
exception caught while emitting MethodBuilder [MainClass::Main]


Unhandled Exception: System.IndexOutOfRangeException: Array index is out of
range.
  at Mono.CSharp.Nullable+NullableInfo..ctor (System.Type type) [0x00000] 
  at Mono.CSharp.Nullable+HasValue.DoResolve (Mono.CSharp.EmitContext ec)
[0x00000] 
  at Mono.CSharp.Expression.Resolve (Mono.CSharp.EmitContext ec, ResolveFlags
flags) [0x00000] 
  at Mono.CSharp.Expression.Resolve (Mono.CSharp.EmitContext ec) [0x00000] 
  at Mono.CSharp.Nullable+HasValue.Create (Mono.CSharp.Expression expr,
Mono.CSharp.EmitContext ec) [0x00000] 
  at Mono.CSharp.Nullable+LiftedBinaryOperator.DoResolve
(Mono.CSharp.EmitContext ec) [0x00000] 
  at Mono.CSharp.Expression.Resolve (Mono.CSharp.EmitContext ec, ResolveFlags
flags) [0x00000] 
  at Mono.CSharp.Expression.Resolve (Mono.CSharp.EmitContext ec) [0x00000] 
  at Mono.CSharp.Binary.DoResolve (Mono.CSharp.EmitContext ec) [0x00000] 
  at Mono.CSharp.Expression.Resolve (Mono.CSharp.EmitContext ec, ResolveFlags
flags) [0x00000] 
  at Mono.CSharp.Expression.Resolve (Mono.CSharp.EmitContext ec) [0x00000] 
  at Mono.CSharp.Argument.Resolve (Mono.CSharp.EmitContext ec, Location loc)
[0x00000] 
  at Mono.CSharp.Invocation.DoResolve (Mono.CSharp.EmitContext ec) [0x00000] 
  at Mono.CSharp.Expression.Resolve (Mono.CSharp.EmitContext ec, ResolveFlags
flags) [0x00000] 
  at Mono.CSharp.Expression.Resolve (Mono.CSharp.EmitContext ec) [0x00000] 
  at Mono.CSharp.ExpressionStatement.ResolveStatement (Mono.CSharp.EmitContext
ec) [0x00000] 
  at Mono.CSharp.StatementExpression.Resolve (Mono.CSharp.EmitContext ec)
[0x00000] 
  at Mono.CSharp.Block.Resolve (Mono.CSharp.EmitContext ec) [0x00000] 
  at Mono.CSharp.EmitContext.ResolveTopBlock (Mono.CSharp.EmitContext
anonymous_method_host, Mono.CSharp.ToplevelBlock block, Mono.CSharp.Parameters
ip, IMethodData md, System.Boolean& unreachable) [0x00000] 


Expected Results:  
False

workaround:

long? a = null;
Console.WriteLine(5 == a);

works ok:

Console.WriteLine(5 < (long?)null);

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