www.digitalmars.com         C & C++   DMDScript  

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

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: dsimcha yahoo.com



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: -------
Feb 08 2011
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5549


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs eml.cc




 This is another insanely hard to reproduce bug.
As (I think) Don has said, back-end bugs are often harder to locate. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 08 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5549


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |clugdbug yahoo.com.au



This sounds quite similar to bug 5455. Both involve register allocation and a
complicated and fragile code sequence.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 08 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5549


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla digitalmars.com



17:56:20 PST ---
https://github.com/D-Programming-Language/dmd/commit/a2b0280ebe1cb40b24c62d199d234bff55bf8024

https://github.com/D-Programming-Language/dmd/commit/8fd6ff07ae7f043e5eff9eb35148f73c54482f96

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 09 2011
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5549


Walter Bright <bugzilla digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED


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