[Mono-bugs] [Bug 555264] New: SIGSEGV instead of StackOverflow
bugzilla_noreply at novell.com
bugzilla_noreply at novell.com
Fri Nov 13 08:30:16 EST 2009
http://bugzilla.novell.com/show_bug.cgi?id=555264
Summary: SIGSEGV instead of StackOverflow
Classification: Mono
Product: Mono: Runtime
Version: unspecified
Platform: Other
OS/Version: Other
Status: NEW
Severity: Normal
Priority: P5 - None
Component: JIT
AssignedTo: lupus at novell.com
ReportedBy: msafar at novell.com
QAContact: mono-bugs at lists.ximian.com
Found By: ---
I think I've finally managed to narrow this bug into small test case
gmcs -t:library bug.cs -r:nunit.framework.dll
nunit-console bug.dll
Stack overflow in unmanaged: IP: 0x8123381, fault addr: 0x1778a28
Stack overflow in unmanaged: IP: 0x810e66e, fault addr: 0x177aff8
Stacktrace:
at (wrapper managed-to-native)
object.__icall_wrapper_mono_object_new_specific (intptr) <0x00051>
at (wrapper managed-to-native)
object.__icall_wrapper_mono_object_new_specific (intptr) <0x00051>
at System.Reflection.MonoMethod.Invoke
(object,System.Reflection.BindingFlags,System.Reflection.Binder,object[],System.Globalization.CultureInfo)
[0x000e5] in
/home/marek/svn/mcs/class/corlib/System.Reflection/MonoMethod.cs:213
>>>>> test.cs
using System;
using System.Runtime.Serialization;
using System.Runtime.InteropServices;
using System.Threading;
using NUnit.Framework;
public class Lazy<T>
{
T value;
bool inited;
Func<T> factory;
object monitor;
public Lazy (Func<T> valueFactory, bool isThreadSafe)
{
if (valueFactory == null)
throw new ArgumentNullException ("valueFactory");
this.factory = valueFactory;
if (isThreadSafe)
monitor = new object ();
}
public T Value {
get {
if (inited)
return value;
return InitValue ();
}
}
T InitValue () {
if (monitor == null) {
value = factory ();
inited = true;
} else {
lock (monitor) {
if (inited)
return value;
if (factory == null)
throw new InvalidOperationException ("The
initialization function tries to access Value on this instance");
var init_factory = factory;
try {
//factory = null;
T v = init_factory ();
value = v;
Thread.MemoryBarrier ();
inited = true;
} catch {
factory = init_factory;
throw;
}
}
}
return value;
}
}
[TestFixture]
public class C
{
[Test]
public void Test ()
{
Lazy<int> c = null;
c = new Lazy<int> (() => { Console.WriteLine (c.Value); return 1; },
true);
var r = c.Value;
}
}
--
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
More information about the mono-bugs
mailing list