[Mono-dev] Regression in SVN - (g)mcs crash & xbuild problem

Mads Bondo Dydensborg mbd at dbc.dk
Thu Nov 22 04:12:17 EST 2007


Hi there

I tried registering at Novell to post this as a bug, but I do not get any 
confirmation email, so here goes:

This program:

---CompilerError.cs-----
class ClassA {}
class ClassB {}
class ClassC {
  // Note, static method
  static public ClassA Build( ClassA a ) {
    return a;
  }
  // Note, instance method
  public ClassB Build( ClassB b ) {
    return b;
  }
}

class CompilerError {
  static public void Main() {
    // OK
    ClassC.Build( new ClassA() );
    // Not OK: Calling Build with ClassB, requires an instance, but
    // (g)mcs crashes instead of complaining
    ClassC.Build( new ClassB() );
  }
}
---------------


should not compile, and wont with 1.2.4:
$ gmcs --version
Mono C# compiler version 1.2.4.0
$ gmcs CompilerError.cs
CompilerError.cs(20,12): error CS0120: `ClassC.Build(ClassB)': An object 
reference is required for the nonstatic field, method or property
Compilation failed: 1 error(s), 0 warnings

BUT, crashes (g)mcs with current SVN (from this morning, probably earlier 
too):

$ gmcs --version
Mono C# compiler version 1.2.6.0
$ gmcs CompilerError.cs
Internal compiler error at CompilerError.cs(15,22):: exception caught while 
emitting MethodBuilder [CompilerError::Main]

Unhandled Exception: System.NullReferenceException: Object reference not set 
to an instance of an object
  at Mono.CSharp.Invocation.EmitCall (Mono.CSharp.EmitContext ec, Boolean 
is_base, Mono.CSharp.Expression instance_expr, System.Reflection.MethodBase 
method, System.Collections.ArrayList Arguments, Location loc, Boolean 
dup_args, Boolean omit_args) [0x00000]
  at Mono.CSharp.Invocation.EmitCall (Mono.CSharp.EmitContext ec, Boolean 
is_base, Mono.CSharp.Expression instance_expr, System.Reflection.MethodBase 
method, System.Collections.ArrayList Arguments, Location loc) [0x00000]
  at Mono.CSharp.MethodGroupExpr.EmitCall (Mono.CSharp.EmitContext ec, 
System.Collections.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) 
[0x00000]
  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 
block, Boolean unreachable) [0x00000]
  at Mono.CSharp.EmitContext.EmitTopBlock (IMethodData md, 
Mono.CSharp.ToplevelBlock block) [0x00000]
  at Mono.CSharp.MethodData.Emit (Mono.CSharp.DeclSpace parent) [0x00000]
  at Mono.CSharp.Method.Emit () [0x00000]


Additionally: xbuild does not detect compiler crashes, so it appears that 
everything is a OK for such a build, when using xbuild. This later is 
actually my worst quip, because it took me almost two hours to realize that a 
subtle problem in a large set of unittests did not resolve itself on our 
integrationserver, becuase xbuild kept reporting that the build went well, 
even though it failed. (So, the unittest system kept running on a very old 
set of binaries, that did not get cleaned out by gmcs or xbuild. Sigh).

Perhaps someone with better luck than me in the bugposting department could 
post this as a bug, or even fix it in the compiler and xbuild program.

Regards,

Mads

-- 
Med venlig hilsen/Regards

Systemudvikler/Systemsdeveloper cand.scient.dat, Ph.d., Mads Bondo Dydensborg
Dansk BiblioteksCenter A/S, Tempovej 7-11, 2750 Ballerup, Tlf. +45 44 86 77 34



More information about the Mono-devel-list mailing list