[Issue 15272] [2.069-rc2,inline] nothing written to output when -inline is set

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sun Nov 1 14:26:46 PST 2015


https://issues.dlang.org/show_bug.cgi?id=15272

--- Comment #7 from ag0aep6g at gmail.com ---
Here's a reduction that segfaults reliably for me with -release -O -inline:
----
extern(C) void* calloc(size_t, size_t) nothrow pure;

void main()
{
    {
        File file_;
        nop();
    }

    auto scache = StringCache(1);
    foreach (nodePointer; scache.buckets)
    {
        if (nodePointer !is null) new Object;
    }
}

struct File
{
    ~this() {}
}

void nop() {}

struct StringCache
{
    this(size_t bucketCount)
    {
        buckets = (cast(void**) calloc(8, bucketCount))[0 .. bucketCount];
    }

    void*[] buckets;
}
----

(In reply to bb.temp from comment #6)
> Yes. I confirm that the fix you suggested in libdparse works.
> 
> But now I don't know whom the bug belongs to...
> Was it accidental that the program worked without -inline and without the
> libdparse fix ?!

I was mistaken. The bug I saw in libdparse is not there. My "fix" probably just
masks the issue somehow.

--


More information about the Digitalmars-d-bugs mailing list