D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 7784 - ICE with self-referencing literals
Summary: ICE with self-referencing literals
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: CTFE, ice, pull
Depends on:
Blocks:
 
Reported: 2012-03-26 17:53 UTC by Martin Nowak
Modified: 2012-04-14 20:27 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Martin Nowak 2012-03-26 17:53:04 UTC
cat > bug.d << CODE
struct Foo
{
    void bug()
    {
        // cyclic reference
        tab["A"] = Bar(&this);
        auto pbar = "A" in tab;
        // triggers stack overflow in Expression::apply for hasSideEffect
        auto bar = *pbar;
    }

    Bar[string] tab;
}

struct Bar
{
    Foo* foo;
    int val;
}

int ctfe()
{
    auto foo = Foo();
    foo.bug();
    return 0;
}

enum run = ctfe();
CODE

--------

We should probably flag all literal expression during visiting
and either skip them or return a different apply result.
Comment 2 github-bugzilla 2012-04-14 18:40:39 UTC
Commits pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/91f3179ea3e9b622e79ebc6b31b66236f1363964
Fix issue 7784 CTFE ICE with self-referencing AA literals

https://github.com/D-Programming-Language/dmd/commit/b7fd092bdc4cc746995cf2c578c4c7bcbc3ebe56
Merge pull request #860 from donc/stackoverflow7784

Fix issue 7784 CTFE ICE with self-referencing AA literals