Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Conversation

@Orvid
Copy link
Contributor

@Orvid Orvid commented Jul 21, 2014

Added a method for the DMD fix to an issue with delete that was uncovered while working on #864

These are the changes required in order for dlang/dmd#3727 to be able to pass the tests.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I always wonder what these empty comments are meant to accomplish. Please add something like "called for 'delete p' if p points to a struct with a destructor, but without operator delete being overloaded."

@rainers
Copy link
Member

rainers commented Aug 1, 2014

Let's move on with this. We should add a unittest here, but it won't work before this PR and the one in DMD are both merged.

@rainers
Copy link
Member

rainers commented Aug 1, 2014

Auto-merge toggled on

@rainers
Copy link
Member

rainers commented Aug 1, 2014

Here is a possible test, though it triggered some more bugs...

import core.memory;

struct S
{
    ~this() {}
    ubyte data[32];
}

version = dmd2065; // need a second block to circumvent bug in caching before dmd 2.066

void main()
{
    S* s = new S;
    version(dmd2065) S* t = new S; 
    S* p = s;
    auto inf = GC.query(p);
    assert(inf.attr & GC.BlkAttr.NO_SCAN);
    delete s;
    version(dmd2065) inf = GC.query(t); // invalidate cache info
    inf = GC.query(p); // crashes if S.sizeof > 2048
    assert(!(inf.attr & GC.BlkAttr.NO_SCAN));
}

rainers added a commit that referenced this pull request Aug 1, 2014
DRuntime Change for DMD#3727
@rainers rainers merged commit 4fabf7d into dlang:master Aug 1, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants