[Issue 6510] [CTFE] "internal error: illegal stack value" when compiled with -inline

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Aug 17 08:34:44 PDT 2011


http://d.puremagic.com/issues/show_bug.cgi?id=6510


Don <clugdbug at yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code


--- Comment #6 from Don <clugdbug at yahoo.com.au> 2011-08-17 08:34:41 PDT ---
Reduced slightly further. If you uncomment the alias, everything works. So this
is a bug which only happens when the semantic pass, and the inlining, is run on
Stack!int *during* CTFE.
The stack.shrink() call gets translated into:
ref Proxy ths = this.stack;
which CTFE chokes on. Note that this is a local reference variable, which isn't
legal D (it can only happen in compiler-generated code).

When the alias is present, the inline scan of bug6510() doesn't happen until
after CTFE has finished. But interestingly an inline scan of UNUSED() still
happens during CTFE.

---

struct Stack(U) {
    struct Proxy { 
        void shrink() {}
    }
    Proxy stack;
    void pop() {
        stack.shrink();
    }
}

alias Stack!int Stuck;

int bug6510() {
    static void UNUSED() {
        Stack!(int) junk;
        junk.pop();
    }
    Stack!(int) opstk;
    opstk.pop();
    return 3;
}

static assert(bug6510());

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list