[phobos] phobos commit, revision 1552

Don Clugston dclugston at googlemail.com
Wed May 26 03:58:51 PDT 2010


It segfaults for me too, but it's not std.xml, it's the previously
reported issue with toDelegate, which still isn't fixed in trunk:
Quoting shin:
-----

obj2asm showed that everything in toDelegate() was optimized away if
compiled with the -O option. Then an uninitialized delegate object was
returned.

Workaround:
--------------------
--- phobos/std/functional.d
+++ phobos/std/functional.d
@@ -590,7 +590,8 @@ auto ref toDelegate(F)(auto ref F fp) if
(isCallable!(F)) { auto dummyDel = &(dummy.doIt);
        df.funcPtr = dummyDel.funcptr;

-        return df.del;
+        auto del = df.del;
+        return del;
    }
 }

--------------------

toDelegate() is an auto ref function. A compiler bug allows the local
variable df.del to be returned by reference. I'm not very sure, but it
leads toDelegate() to return (reference to) uninitialized value.

I filed the bug into bugzilla:
http://d.puremagic.com/issues/show_bug.cgi?id=4232



On 26 May 2010 12:46, Walter Bright <walter at digitalmars.com> wrote:
>
>
> Shin Fujishiro wrote:
>>>
>>> The unittests in std.xml throw an access violation.
>>>
>>>
>>
>> I'm sorry but I can't reproduce it on FreeBSD, Gentoo Linux nor Wine.
>>
>> I believe changeset 1552 does not contain anything that can cause
>> access violation. The access violation was thrown by std.functional,
>> wasn't it?
>>
>>
>>
>
> It's dying in Windows. The debugger says it was in std.xml, but it might be
> in error.
> _______________________________________________
> phobos mailing list
> phobos at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/phobos
>


More information about the phobos mailing list