[Issue 5549] New: [64-bit] Internal error: backend/cgcod.c 1845

d-bugmail at puremagic.com d-bugmail at puremagic.com
Tue Feb 8 16:57:53 PST 2011


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

           Summary: [64-bit] Internal error: backend/cgcod.c 1845
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: dsimcha at yahoo.com


--- Comment #0 from David Simcha <dsimcha at yahoo.com> 2011-02-08 16:55:28 PST ---
This is another insanely hard to reproduce bug.  The following code produces a
"Internal error: backend/cgcod.c 1845" only when compiled with -O -inline
-release -unittest -m64.  I reduced it as far as I could.  All of the seemingly
unnecessary stuff is actually necessary for reproducing this bug.  Also, when I
copy/paste the implementation of Map into the same module as the code below, it
seems to prevent the bug from being reproduced.

import std.algorithm;

void cleanUp() {}

void doStuff(T)(T data) {
    scope(exit) cleanUp();  // Taking this out gets rid of the bug.
    size_t N = 0;

    foreach(i, rng; data) {  // Taking this loop out gets rid of the bug.
        auto rngLen = rng.length;
        N += rngLen;
    }

    int[] dataArray;
    size_t pos = 0;
    foreach(rng; data) {   // This loop is necessary.
        foreach(elem; rng) {
            dataArray[pos] = elem;
            pos++;
        }
    }

    double rBar = 0.5 * (N + 1);  // Even this line is necessary.
}

void main() {
    // Only happens on instantiations with Map.
    doStuff(
        [map!"a"([3,1,4,1])]
    );
}

-- 
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