[Mono-bugs] [Bug 77495][Cri] New - Mono compiler crashes while
compiling C# code.
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Tue Feb 7 15:53:02 EST 2006
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by mwickline at maad.com.
http://bugzilla.ximian.com/show_bug.cgi?id=77495
--- shadow/77495 2006-02-07 15:53:02.000000000 -0500
+++ shadow/77495.tmp.31400 2006-02-07 15:53:02.000000000 -0500
@@ -0,0 +1,309 @@
+Bug#: 77495
+Product: Mono: Compilers
+Version: 1.1
+OS: Mandrake 9.0
+OS Details: x86, glibc 2.2.5
+Status: NEW
+Resolution:
+Severity:
+Priority: Critical
+Component: C#
+AssignedTo: rharinath at novell.com
+ReportedBy: mwickline at maad.com
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Mono compiler crashes while compiling C# code.
+
+Please fill in this template when reporting a bug, unless you know what you
+are doing.
+Description of Problem:
+While attempting to compile some code, Mono crashes with a seg fault.
+
+Steps to reproduce the problem:
+1. tar xzvf MonoCompilerCrashTest.tgz
+2. make
+
+Actual Results:
+Under mono 1.1.8.0:
+mcs -out:TestSMG.exe -target:exe -r:System.dll,IPME.SimEngine.dll
+StandaloneConstants.cs HelloWorld.cs
+
+** (/usr/local/mono-1.1.8/lib/mono/1.0/mcs.exe:2599): WARNING **: The class
+MAAD.Utilities.IPerformanceTimer could not be loaded, used in
+/home/mwickline/Output_IPME4/TestSMG/TestCase/IPME.SimEngine.dll (token
+0x0100000a)
+
+Unhandled Exception: System.NullReferenceException: Object reference not
+set to an instance of an object
+in <0x00000> <unknown method>
+in (wrapper managed-to-native) System.MonoType:GetFields_internal
+(System.Reflection.BindingFlags,System.Type)
+in <0x00013> System.MonoType:GetFields (BindingFlags bindingAttr)
+in <0x002c9> System.Type:FindMembers (MemberTypes memberType, BindingFlags
+bindingAttr, System.Reflection.MemberFilter filter, System.Object
+filterCriteria)
+in <0x0004a> Mono.CSharp.TypeHandle:GetMembers (MemberTypes mt,
+BindingFlags bf)
+in <0x00034> Mono.CSharp.MemberCache:AddMembers (MemberTypes mt,
+BindingFlags bf, IMemberContainer container)
+in <0x0004f> Mono.CSharp.MemberCache:AddMembers (MemberTypes mt,
+IMemberContainer container)
+in <0x0003d> Mono.CSharp.MemberCache:AddMembers (IMemberContainer container)
+in <0x00164> Mono.CSharp.MemberCache:.ctor (IMemberContainer container)
+in <0x000b9> Mono.CSharp.TypeHandle:.ctor (System.Type type)
+in <0x00051> Mono.CSharp.TypeHandle:GetTypeHandle (System.Type t)
+in <0x0000b> Mono.CSharp.TypeHandle:GetMemberCache (System.Type t)
+in <0x0014c> Mono.CSharp.TypeManager:MemberLookup_FindMembers (System.Type
+t, MemberTypes mt, BindingFlags bf, System.String name, System.Boolean
+used_cache)
+in <0x00234> Mono.CSharp.TypeManager:RealMemberLookup (System.Type
+invocation_type, System.Type qualifier_type, System.Type queried_type,
+MemberTypes mt, BindingFlags original_bf, System.String name, IList
+almost_match)
+in <0x0001f> Mono.CSharp.TypeManager:MemberLookup (System.Type
+invocation_type, System.Type qualifier_type, System.Type queried_type,
+MemberTypes mt, BindingFlags original_bf, System.String name, IList
+almost_match)
+in <0x00035> Mono.CSharp.Expression:MemberLookup (Mono.CSharp.EmitContext
+ec, System.Type container_type, System.Type qualifier_type, System.Type
+queried_type, System.String name, MemberTypes mt, BindingFlags bf, Location
+loc)
+in <0x0002f> Mono.CSharp.Expression:MemberLookupFinal
+(Mono.CSharp.EmitContext ec, System.Type qualifier_type, System.Type
+queried_type, System.String name, MemberTypes mt, BindingFlags bf, Location
+loc)
+in <0x0025c> Mono.CSharp.New:DoResolve (Mono.CSharp.EmitContext ec)
+in <0x000c2> Mono.CSharp.Expression:Resolve (Mono.CSharp.EmitContext ec,
+ResolveFlags flags)
+in <0x00015> Mono.CSharp.Expression:Resolve (Mono.CSharp.EmitContext ec)
+in <0x000d2> Mono.CSharp.Assign:DoResolve (Mono.CSharp.EmitContext ec)
+in <0x000c2> Mono.CSharp.Expression:Resolve (Mono.CSharp.EmitContext ec,
+ResolveFlags flags)
+in <0x00015> Mono.CSharp.Expression:Resolve (Mono.CSharp.EmitContext ec)
+in <0x00016> Mono.CSharp.ExpressionStatement:ResolveStatement
+(Mono.CSharp.EmitContext ec)
+in <0x0001f> Mono.CSharp.StatementExpression:Resolve
+(Mono.CSharp.EmitContext ec)
+in <0x0014b> Mono.CSharp.Block:Resolve (Mono.CSharp.EmitContext ec)
+in <0x000e2> Mono.CSharp.EmitContext:ResolveTopBlock
+(Mono.CSharp.EmitContext anonymous_method_host, Mono.CSharp.ToplevelBlock
+block, Mono.CSharp.InternalParameters ip, Location loc, System.Boolean
+unreachable)
+in <0x00030> Mono.CSharp.EmitContext:EmitTopBlock
+(Mono.CSharp.ToplevelBlock block, Mono.CSharp.InternalParameters ip,
+Location loc)
+in <0x00335> Mono.CSharp.MethodData:Emit (Mono.CSharp.TypeContainer
+container, Mono.CSharp.Attributable kind)
+in <0x00022> Mono.CSharp.Method:Emit ()
+in <0x0068d> Mono.CSharp.TypeContainer:EmitType ()
+in <0x00249> Mono.CSharp.RootContext:EmitCode ()
+in <0x00c0c> Mono.CSharp.Driver:MainDriver (System.String[] args)
+in <0x0000f> Mono.CSharp.Driver:Main (System.String[] args)
+make: *** [all] Error 1
+
+Under mono 1.1.12.1:
+
+mcs -out:TestSMG.exe -target:exe -r:System.dll,IPME.SimEngine.dll
+StandaloneConstants.cs HelloWorld.cs
+
+** (/usr/local/mono-1.1.12.1/lib/mono/1.0/mcs.exe:2693): WARNING **: The
+class MAAD.Utilities.IPerformanceTimer could not be loaded, used in
+MAAD.Utilities, Version=1.0.0.0, Culture=neutral,
+PublicKeyToken=180312e8e8e17960
+
+=================================================================
+Got a SIGSEGV while executing native code. This usually indicates
+a fatal error in the mono runtime or one of the native libraries
+used by your application.
+=================================================================
+
+Stacktrace:
+
+in <0x4> (wrapper managed-to-native) System.MonoType:GetFields_internal
+(System.Reflection.BindingFlags,System.Type)
+in <0xffffffe8> (wrapper managed-to-native)
+System.MonoType:GetFields_internal (System.Reflection.BindingFlags,System.Type)
+in <0x10> System.MonoType:GetFields (System.Reflection.BindingFlags)
+in <0x280> System.Type:FindMembers
+(System.Reflection.MemberTypes,System.Reflection.BindingFlags,System.Reflection.MemberFilter,object)
+in <0x4a> Mono.CSharp.TypeHandle:GetMembers
+(System.Reflection.MemberTypes,System.Reflection.BindingFlags)
+in <0x34> Mono.CSharp.MemberCache:AddMembers
+(System.Reflection.MemberTypes,System.Reflection.BindingFlags,Mono.CSharp.IMemberContainer)
+in <0x3f> Mono.CSharp.MemberCache:AddMembers
+(System.Reflection.MemberTypes,Mono.CSharp.IMemberContainer)
+in <0x3c> Mono.CSharp.MemberCache:AddMembers (Mono.CSharp.IMemberContainer)
+in <0x155> Mono.CSharp.MemberCache:.ctor (Mono.CSharp.IMemberContainer)
+in <0xbc> Mono.CSharp.TypeHandle:.ctor (System.Type)
+in <0x4e> Mono.CSharp.TypeHandle:GetTypeHandle (System.Type)
+in <0xb> Mono.CSharp.TypeHandle:GetMemberCache (System.Type)
+in <0x14e> Mono.CSharp.TypeManager:MemberLookup_FindMembers
+(System.Type,System.Reflection.MemberTypes,System.Reflection.BindingFlags,string,bool&)
+in <0x1ad> Mono.CSharp.TypeManager:RealMemberLookup
+(System.Type,System.Type,System.Type,System.Reflection.MemberTypes,System.Reflection.BindingFlags,string,System.Collections.IList)
+in <0x1f> Mono.CSharp.TypeManager:MemberLookup
+(System.Type,System.Type,System.Type,System.Reflection.MemberTypes,System.Reflection.BindingFlags,string,System.Collections.IList)
+in <0x38> Mono.CSharp.Expression:MemberLookup
+(Mono.CSharp.EmitContext,System.Type,System.Type,System.Type,string,System.Reflection.MemberTypes,System.Reflection.BindingFlags,Mono.CSharp.Location)
+in <0x2f> Mono.CSharp.Expression:MemberLookupFinal
+(Mono.CSharp.EmitContext,System.Type,System.Type,string,System.Reflection.MemberTypes,System.Reflection.BindingFlags,Mono.CSharp.Location)
+in <0x301> Mono.CSharp.New:DoResolve (Mono.CSharp.EmitContext)
+in <0xe3> Mono.CSharp.Expression:Resolve
+(Mono.CSharp.EmitContext,Mono.CSharp.ResolveFlags)
+in <0x12> Mono.CSharp.Expression:Resolve (Mono.CSharp.EmitContext)
+in <0xd7> Mono.CSharp.Assign:DoResolve (Mono.CSharp.EmitContext)
+in <0xe3> Mono.CSharp.Expression:Resolve
+(Mono.CSharp.EmitContext,Mono.CSharp.ResolveFlags)
+in <0x12> Mono.CSharp.Expression:Resolve (Mono.CSharp.EmitContext)
+in <0x13> Mono.CSharp.ExpressionStatement:ResolveStatement
+(Mono.CSharp.EmitContext)
+in <0x1f> Mono.CSharp.StatementExpression:Resolve (Mono.CSharp.EmitContext)
+in <0x1d9> Mono.CSharp.Block:Resolve (Mono.CSharp.EmitContext)
+in <0x122> Mono.CSharp.EmitContext:ResolveTopBlock
+(Mono.CSharp.EmitContext,Mono.CSharp.ToplevelBlock,Mono.CSharp.Parameters,Mono.CSharp.IMethodData,bool&)
+in <0x4b> Mono.CSharp.EmitContext:EmitTopBlock
+(Mono.CSharp.IMethodData,Mono.CSharp.ToplevelBlock)
+in <0x1ab> Mono.CSharp.MethodData:Emit
+(Mono.CSharp.TypeContainer,Mono.CSharp.Attributable)
+in <0x29> Mono.CSharp.Method:Emit ()
+in <0x64d> Mono.CSharp.TypeContainer:EmitType ()
+in <0x226> Mono.CSharp.RootContext:EmitCode ()
+in <0xaac> Mono.CSharp.Driver:MainDriver (string[])
+in <0x41> Mono.CSharp.Driver:Main (string[])
+in <0xc76b8b8e> (wrapper runtime-invoke)
+System.Object:runtime_invoke_int_string[] (object,intptr,intptr,intptr)
+
+Native stacktrace:
+
+ /usr/local/mono-1.1.12.1/bin/mono [0x814443b]
+ /lib/i686/libpthread.so.0 [0x400beef4]
+ /lib/i686/libc.so.6 [0x40128350]
+ /usr/local/mono-1.1.12.1/bin/mono(mono_g_hash_table_lookup+0x24)
+[0x810a9b4]
+ /usr/local/mono-1.1.12.1/bin/mono(mono_type_get_object+0x43)
+[0x80bce63]
+ /usr/local/mono-1.1.12.1/bin/mono(mono_field_get_object+0x115)
+[0x80c22b5]
+ /usr/local/mono-1.1.12.1/bin/mono [0x80df08f]
+ [0x40d54862]
+ [0x40d54821]
+ [0x40d54081]
+ [0x40d53dc3]
+ [0x40d53a9d]
+ [0x40d53a58]
+ [0x40d53995]
+ [0x40d52ec6]
+ [0x40d52d2d]
+ [0x40d52c2f]
+ [0x40d52aec]
+ [0x41161bf7]
+ [0x41161566]
+ [0x41161398]
+ [0x411610d1]
+ [0x4117c1c0]
+ [0x4117bbda]
+ [0x40d5e93c]
+ [0x41169f33]
+ [0x41174ce8]
+ [0x40d5e93c]
+ [0x41169f33]
+ [0x41174bc4]
+ [0x41178160]
+ [0x41167382]
+ [0x41166cc3]
+ [0x41166b2c]
+ [0x4117a4cc]
+ [0x4117a0fa]
+ [0x4115d1fe]
+ [0x4115c73f]
+ [0x40a2506d]
+ [0x40a23ae2]
+ [0x40a1e86c]
+ /usr/local/mono-1.1.12.1/bin/mono(mono_runtime_exec_main+0x11f)
+[0x80d73cf]
+ /usr/local/mono-1.1.12.1/bin/mono(mono_runtime_run_main+0x1dc)
+[0x80d763c]
+ /usr/local/mono-1.1.12.1/bin/mono(mono_main+0xeed) [0x805d42d]
+ /usr/local/mono-1.1.12.1/bin/mono(g_ascii_strcasecmp+0x112) [0x805c0ce]
+ /lib/i686/libc.so.6(__libc_start_main+0xa2) [0x40117082]
+ /usr/local/mono-1.1.12.1/bin/mono(strcpy+0x35) [0x805c011]
+make: *** [all] Aborted
+
+
+Expected Results:
+It should compile.
+
+How often does this happen?
+Always.
+
+Additional Information:
+
+This problem actually showed up for us while making use of the internal
+CSharp compiler, with the following (approximate) code. However, it was
+difficult to know what the problem actually was, because the call to
+"icc.CompileAssemblyFromSourceBatch()" threw a FileNotFoundException,
+indicating that it couldn't find the file (e.g. "HelloWorld.exe") that it
+was supposed to be generating. Compiling from the command line shows a
+stack trace, so the test case is based on that.
+
+ private int CompileStandaloneWrapper(StandaloneModelParams smp)
+ {
+ CSharpCodeProvider codeProvider = new Microsoft.CSharp.CSharpCodeProvider();
+ ICodeCompiler icc = codeProvider.CreateCompiler();
+ System.CodeDom.Compiler.CompilerParameters parameters = new
+CompilerParameters();
+
+ // The compiler throws a FileNotFoundException if we try to make it generate
+ // an executable outside of memory.
+ parameters.GenerateExecutable = true;
+ parameters.GenerateInMemory = false;
+ parameters.MainClass = "MAAD.IPME.HelloWorld";
+
+ parameters.OutputAssembly = "HelloWorld.exe";
+
+ parameters.IncludeDebugInformation = false;
+ parameters.CompilerOptions = "/optimize";
+
+
+ foreach(string assemblyRef in smp.AssemblyRefs)
+ {
+ parameters.ReferencedAssemblies.Add(assemblyRef);
+ }
+
+ CompilerResults results = null;
+ string[] sources = GetStandaloneSourceFiles(smp);
+
+ try
+ {
+ results = icc.CompileAssemblyFromSourceBatch(parameters, sources);
+ }
+ catch(Exception e)
+ {
+ //DEBUG
+ Console.WriteLine("Caught exception: {0}", e);
+ //DEBUG
+
+ HandleStandaloneModelGenCompileException(e);
+ return 1;
+ }
+
+ int totalErrors = 0;
+ if(results.Errors.Count > 0)
+ {
+ foreach(CompilerError compErr in results.Errors)
+ {
+ if(compErr.IsWarning)
+ {
+ HandleStandaloneModelGenCompilerWarning(compErr);
+ }
+ else
+ {
+ ++totalErrors;
+ HandleStandaloneModelGenCompilerError(compErr);
+ }
+ }
+ }
+ return totalErrors;
+ }
More information about the mono-bugs
mailing list