[Issue 15079] [REG2.068.1] Assertion `fd->semanticRun == PASSsemantic3done' failed.

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Sat Sep 26 19:06:06 PDT 2015


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

Kenji Hara <k.hara.pg at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |rejects-valid
           Hardware|x86_64                      |All
            Summary|Assertion `fd->semanticRun  |[REG2.068.1] Assertion
                   |== PASSsemantic3done'       |`fd->semanticRun ==
                   |failed.                     |PASSsemantic3done' failed.
                 OS|Linux                       |All

--- Comment #5 from Kenji Hara <k.hara.pg at gmail.com> ---
(In reply to Marc Schütz from comment #4)
> Created attachment 1552 [details]
> reduced testcase

Thank you very much, Marc!

I've slightly tweaked the case and get the minimum code to reproduce the error.

scan_code.d:
---
import parsing;

parsing.d:
---
Vector!string parseAlgorithmName()
{
    assert(0);
}

struct Vector(ALLOC)
{
    @disable this(this);

    RefCounted!(Vector, ALLOC) dupr()
    {
        assert(0);
    }
}

struct RefCounted(T, ALLOC)
{
    ~this()
    {
        T* objc;
        .destroy(*objc);
    }
}

// ----

void _destructRecurse(S)(ref S s)
    if (is(S == struct))
{
    static if (__traits(hasMember, S, "__xdtor") &&
               __traits(isSame, S, __traits(parent, s.__xdtor)))
    {
        s.__xdtor();
    }
}

void destroy(T)(ref T obj) if (is(T == struct))
{
    _destructRecurse(obj);
    () @trusted {
        auto buf = (cast(ubyte*) &obj)[0 .. T.sizeof];
        auto init = cast(ubyte[])typeid(T).init();
        if (init.ptr is null) // null ptr means initialize to 0s
            buf[] = 0;
        else
            buf[] = init[];
    } ();
}

command line:
---
dmd -c scan_token.d

parsing.d(8): Error: function parsing.Vector!string.Vector.__aggrPostblit
errors compiling the function


Fortunately, the error is now disappeared with git-head. After the bisecting
git history, I've reached to the commit which the issue has fixed.

  SHA-1: af4d3a4158f95d1720b42e8027ae2aead90c7a4f

  Merge pull request #5075 from 9rnsr/fix15044

  [REG2.068.0] Issue 15044 - destroy might leak memory


As a conclusion, it was another surface of issue 15044, and fixed from 2.068.2
- the attribute inference problem had sent a function which is not yet
completed semantic analysis to glue layer, and the breaking of internal
invariance has been detected.

--


More information about the Digitalmars-d-bugs mailing list