[Issue 4504] New: Internal compiler error using std.algorithm.count with recursive nested function in release.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jul 25 04:44:07 PDT 2010


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

           Summary: Internal compiler error using std.algorithm.count with
                    recursive nested function in release.
           Product: D
           Version: D2
          Platform: x86_64
        OS/Version: Mac OS X
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: peter.alexander.au at gmail.com


--- Comment #0 from Peter Alexander <peter.alexander.au at gmail.com> 2010-07-25 04:44:05 PDT ---
Compiling the following produces the error at compile time: "Internal error:
toir.c 190"

import std.algorithm;
import std.range;

void main()
{
    int foo(int i) { return i == 1 ? 1 : foo(1); }
    auto x = count(map!foo(iota(1, 2)), 1);
}

Only happens when:
- foo is recursive
- foo is a local function (doesn't happen if it is global)
- when using count (calling the function alone, or just mapping is fine)
- when compiling with (-inline)

If any one of these conditions isn't met then the code compiles as expected.

Note that while I have only noticed that std.algorithm.count causes this
problem, and std.algorithm.map doesn't, I haven't tested any other algorithms.

I'm using DMD 2.047.

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