[dmd-internals] Static initialization from Struct literals

Sebastian Graf SebastianGraf at t-online.de
Fri Feb 1 12:43:43 PST 2013


Hi,

I was fixing a bug in ldc while I noticed strange behavior in the dmd
implementation.

struct S { int array[4]; }

void main()
{
    S local = S(67); // local.array = [67, 67, 67, 67]
    static S static_ = S(67); // static_.array = [67, 0, 0, 0]
    assert(local == static_);
}


The assert fails both on current dmd and ldc. Since this is a shady
mismatch, I filed a bug report
http://d.puremagic.com/issues/show_bug.cgi?id=9425. However when checking
the integrity of my commit, the testsuite failed at
http://github.com/D-Programming-Language/dmd/blob/e7eff4deef0fb5ec9a89cee4716785832fc41fb9/test/runnable/test42.d#L3223
.
Is this static/runtime initialization mismatch intended after all or should
I submit a pull request? That would mean that those tests break for other d
implementations though.
Note that this currently blocks some dependant fixes to be submitted into
ldc.

Sebastian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/dmd-internals/attachments/20130201/1174f72d/attachment.html>


More information about the dmd-internals mailing list