Jump to page: 1 2
Thread overview
[Issue 4504] New: Internal compiler error using std.algorithm.count with recursive nested function in release.
Jul 25, 2010
Peter Alexander
Jul 25, 2010
Peter Alexander
[Issue 4504] Internal compiler error using std.algorithm.count with recursive nested function and -inline.
Jul 25, 2010
Peter Alexander
[Issue 4504] ICE(toir.c) using std.algorithm.count with recursive nested function and -inline.
Nov 22, 2010
Don
[Issue 4504] ICE(toir.c) using std.algorithm.count with recursive nested function passed by alias
Nov 22, 2010
Don
Nov 22, 2010
Don
Feb 06, 2011
Brad Roberts
[Issue 4504] ICE(toir.c) nested function passed by alias to nested member function
Oct 25, 2011
Don
Mar 13, 2012
Walter Bright
May 03, 2012
Don
July 25, 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@puremagic.com
        ReportedBy: peter.alexander.au@gmail.com


--- Comment #0 from Peter Alexander <peter.alexander.au@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: -------
July 25, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4504


bearophile_hugs@eml.cc changed:

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


--- Comment #1 from bearophile_hugs@eml.cc 2010-07-25 04:49:55 PDT ---
On Windows, dmd 2.047, I don't see the error.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 25, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4504



--- Comment #2 from Peter Alexander <peter.alexander.au@gmail.com> 2010-07-25 04:52:25 PDT ---
(In reply to comment #1)
> On Windows, dmd 2.047, I don't see the error.

Interesting. Did you compile with -inline?

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 25, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4504



--- Comment #3 from bearophile_hugs@eml.cc 2010-07-25 05:40:21 PDT ---
I'm using just basic compilation:
dmd test.d

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
July 25, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4504



--- Comment #4 from Peter Alexander <peter.alexander.au@gmail.com> 2010-07-25 05:53:59 PDT ---
(In reply to comment #3)
> I'm using just basic compilation:
> dmd test.d

Well you won't get the error :P

"Only happens when:
...
- when compiling with (-inline)"

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 22, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4504



--- Comment #5 from Don <clugdbug@yahoo.com.au> 2010-11-22 02:02:04 PST ---
Reduced test case, from the duplicate bug 4784.
---

struct A( alias P ) {
    static void a() {
        void aa() { P(); }
    }
}

template B( alias P ) {
    void b() { A!P a; }
}

struct C( alias P ) {
    void c() { B!P.b(); }
}

void main() {
    void bar() {}
    C!bar c;
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 22, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4504


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|ICE(toir.c) using           |ICE(toir.c) using
                   |std.algorithm.count with    |std.algorithm.count with
                   |recursive nested function   |recursive nested function
                   |and -inline.                |passed by alias


--- Comment #6 from Don <clugdbug@yahoo.com.au> 2010-11-22 02:07:10 PST ---
The reduced case shows it doesn't require -inline.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
November 22, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4504



--- Comment #7 from Don <clugdbug@yahoo.com.au> 2010-11-22 02:12:16 PST ---
*** Issue 4784 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 06, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4504


Brad Roberts <braddr@puremagic.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Platform|x86_64                      |x86


--- Comment #8 from Brad Roberts <braddr@puremagic.com> 2011-02-06 15:40:12 PST ---
Mass migration of bugs marked as x86-64 to just x86.  The platform run on isn't what's relevant, it's if the app is a 32 or 64 bit app.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
October 25, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=4504


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Version|D2                          |D1 & D2
            Summary|ICE(toir.c) using           |ICE(toir.c) nested function
                   |std.algorithm.count with    |passed by alias to nested
                   |recursive nested function   |member function
                   |passed by alias             |
         OS/Version|Mac OS X                    |All


--- Comment #9 from Don <clugdbug@yahoo.com.au> 2011-10-25 02:49:48 PDT ---
Reduced test case applies to D1 as well:

struct B4504(alias P)
{
    static void a() {
        void aa() {
            P();
        }
    }
}

void bug4504() {
    void bar() {}
    B4504!(bar) b;
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
« First   ‹ Prev
1 2