[Issue 14214] Internal error: backend/go.c 242

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Jun 22 00:03:25 PDT 2015


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice
           Severity|normal                      |major

--- Comment #2 from Kenji Hara <k.hara.pg at gmail.com> ---
Further reduced test case:

alias TypeTuple(T...) = T;
alias members = TypeTuple!(
    0,0,0,0,0,0,0,0,0,0,
    0,0,0,0,0,0,0,0,0,0,
    0,0,0,0,0,0,0,0,0,0,
    0,0,0,0,0,0,0,0,0,0,
    0,0,0,0,0,0,0,0,0,0,
    0,0,0,0,0,0,0,0,0,0,
    0,0,0,0,0,0,0,0,0,0,
    0,0,0,0,0,0,0,0,0,0,
    0,0,0,0,0,0,0,0,0,0,
    0,0,0,0,0,0,0,0,0,
    0,  // error will disappear by removing one element
);

void main()
{
    int row = 0;
    foreach (_unused; members)  // copy the loop body 100 times
    {
        ++row;
        if (row)
            row = 0; // error triggered by this line.
    }
}

----------------------

The ICE seems happened by the assertion with incorrect assumption for "infinite
loop check". But I'm not sure the correct iteration limit...

backend/go.c =======

    // Each pass through the loop can reduce only one level of comma
expression.
    // The infinite loop check needs to take this into account.
    // Add 100 just to give optimizer more rope to try to converge.
    int iterationLimit = 0;
    for (b = startblock; b; b = b->Bnext)
    {
        if (!b->Belem)
            continue;
        int d = el_countCommas(b->Belem) + 100;
        if (d > iterationLimit)
            iterationLimit = d;
    }

    // Some functions can take enormous amounts of time to optimize.
    // We try to put a lid on it.
    starttime = clock();
    do
    {
        //printf("iter = %d\n", iter);
        if (++iter > 200)
        {   assert(iter < iterationLimit);      // infinite loop check
<-- the assert is on line 242
            break;
        }

--


More information about the Digitalmars-d-bugs mailing list