www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 10317] New: Regression (2.063): Recursive error within Phobos

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10317

           Summary: Regression (2.063): Recursive error within Phobos
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: andrej.mitrovich gmail.com


--- Comment #0 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-06-09
07:21:42 PDT ---
-----
module test;

import std.algorithm;

struct Set(E)
{
    E[] sortedElements() inout
    {
        E[] elems = payload.keys;
        sort(elems);  // Causes error
        return elems;
    }

    int[E] payload;
}

enum E { a, b }

struct S
{
    Set!E e;
}

void main()
{
    S s;
}
-----

2.062:
$ dmd test.d

2.063
$ dmd test.d
C:\DMD\dmd2\windows\bin\..\..\src\phobos\std\format.d(2009): Error: template
instance std.traits.CharTypeOf!(E) recursive expansion

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 09 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10317



--- Comment #1 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-06-09
17:31:33 PDT ---
Btw, when building with MSC the error never shows up, the compiler just spins
the CPU forever. I guess this is a bug of its own.

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


Andrei Alexandrescu <andrei erdani.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrei erdani.com


--- Comment #2 from Andrei Alexandrescu <andrei erdani.com> 2013-06-09 18:18:15
PDT ---
Simplified: 

import std.algorithm;

enum E { a, b }

void main()
{
    auto a = new E[100];
    sort(a);
}

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



--- Comment #3 from Andrei Alexandrescu <andrei erdani.com> 2013-06-09 19:08:51
PDT ---
I looked into this, here's how far I got:

On
https://github.com/D-Programming-Language/phobos/blob/master/std/algorithm.d#L8130,
"static if (is(typeof(text(r))))" is evaluated. That's what's causing the
crash. The question is what's causing the bug. I don't know; instantiating
typeof(text(r)) works properly in tests.

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



--- Comment #4 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-06-09
19:12:35 PDT ---
(In reply to comment #3)
 I looked into this, here's how far I got:
 
 On
 https://github.com/D-Programming-Language/phobos/blob/master/std/algorithm.d#L8130,
 "static if (is(typeof(text(r))))" is evaluated. That's what's causing the
 crash. The question is what's causing the bug. I don't know; instantiating
 typeof(text(r)) works properly in tests.
What I'm wondering: when does text(r) ever not work? Is there an actual test-case for this? -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 09 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10317



--- Comment #5 from Andrei Alexandrescu <andrei erdani.com> 2013-06-09 19:14:03
PDT ---
(In reply to comment #4)
 (In reply to comment #3)
 I looked into this, here's how far I got:
 
 On
 https://github.com/D-Programming-Language/phobos/blob/master/std/algorithm.d#L8130,
 "static if (is(typeof(text(r))))" is evaluated. That's what's causing the
 crash. The question is what's causing the bug. I don't know; instantiating
 typeof(text(r)) works properly in tests.
What I'm wondering: when does text(r) ever not work? Is there an actual test-case for this?
Hmm, good point. I don't know. I think at this time we have a textual representation for everything. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 09 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10317



--- Comment #6 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-06-09
19:43:52 PDT ---
(In reply to comment #5)
 Hmm, good point. I don't know. I think at this time we have a textual
 representation for everything.
Ok, I'll whip up a quick test and a phobos pull, so we can at least avoid blocking the .2 release. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 09 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10317



--- Comment #7 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-06-09
19:47:10 PDT ---
(In reply to comment #6)
 (In reply to comment #5)
 Hmm, good point. I don't know. I think at this time we have a textual
 representation for everything.
Ok, I'll whip up a quick test and a phobos pull, so we can at least avoid blocking the .2 release.
https://github.com/D-Programming-Language/phobos/pull/1343 -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Jun 09 2013
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10317



--- Comment #8 from github-bugzilla puremagic.com 2013-06-10 09:41:21 PDT ---
Commits pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/8f5f220194c313dad1cdc36db797ecbee78844d0
Fix Issue 10317 - Remove text(range) check and avoid recursive instantiation
bug.

https://github.com/D-Programming-Language/phobos/commit/28189ff131e9003d1b0ed5a148f43d65f1823c87
Merge pull request #1343 from AndrejMitrovic/Fix10317

Issue 10317 - Remove text(range) check and avoid recursive instantiation bug.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 10 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=10317


Andrej Mitrovic <andrej.mitrovich gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|Regression (2.063):         |(2.063): Recursive error
                   |Recursive error within      |within Phobos
                   |Phobos                      |
           Severity|regression                  |normal


--- Comment #9 from Andrej Mitrovic <andrej.mitrovich gmail.com> 2013-06-10
11:35:58 PDT ---
The library fix is in place, but we still have to figure out why 2.062 doesn't
exhibit the same behavior even though it has the same library code. So I'm
downgrading this to a normal bug to avoid blocking the .2 release

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Jun 10 2013