www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 5590] New: ICE when using .values on enum which is associative array

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

           Summary: ICE when using .values on enum which is associative
                    array
           Product: D
           Version: unspecified
          Platform: x86
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody puremagic.com
        ReportedBy: jmdavisProg gmx.com



PST ---
On dmd 2.051, this code

import std.path;
import std.range;

enum aa = [5 : "hello"];

void main(string[] args)
{
    auto a = aa.values.front;
}


fails to compile, giving this error: Internal error: e2ir.c 4617
With the current beta, it gives: Internal error: e2ir.c 4835


compiler details to know for sure, but it does seem similar. It's definitely
not quite the same circumstances though, so I'm creating a new bug just in case
it is something separate.

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


kennytm gmail.com changed:

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



*** Issue 5734 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: -------
Mar 14 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5590


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |clugdbug yahoo.com.au
         Resolution|                            |DUPLICATE



*** This issue has been marked as a duplicate of issue 4460 ***

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


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
                 CC|                            |yebblies gmail.com
           Platform|x86                         |All
         Resolution|DUPLICATE                   |
         OS/Version|Linux                       |All



Not a duplicate, but probably related.

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


yebblies <yebblies gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch
            Version|unspecified                 |D2
           Severity|normal                      |regression



https://github.com/D-Programming-Language/dmd/pull/685

Regression as this used to work before AssociativeArray was added to object.d. 
The old code is still there in TypeAArray::dotExp, and still works.

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


Walter Bright <bugzilla digitalmars.com> changed:

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



19:51:50 PST ---
Clearly, the AA solution in D needs some re-engineering, so I'm going to have
to defer fixing this for the moment.

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





 Clearly, the AA solution in D needs some re-engineering, so I'm going to have
 to defer fixing this for the moment.
This is also fixed by rolling back the AA implementation. https://github.com/D-Programming-Language/dmd/pull/688 https://github.com/D-Programming-Language/druntime/pull/143 If this is pulled (which I think it should be) this bug report can be closed. Pull 688 contains test cases for this bug. -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: -------
Feb 06 2012
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5590


Don <clugdbug yahoo.com.au> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
            Summary|ICE(e2ir.c): when using     |Regression(2.036)
                   |.values on enum which is    |ICE(e2ir.c): when using
                   |associative array           |.values on enum which is
                   |                            |associative array



Although this is a regression, it isn't recent. It last worked in 2.035
Minimal test case is:

enum aa = [5 : "hello"];

void bug5520()
{
    auto a = aa.values;
}

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




For anyone interested in why this bug exists:

When the 'aa' of 'aa.values' reaches e2ir, it is an 'ArrayLiteralExp' but is
typed as the 'AssociativeArray' struct, because the type is changed in order to
do member lookup.  Changing the type back to an AA doesn't work, I assume
because _d_assocarrayliteralTX returns a reference to an associative array and
the compiler gets very confused about where it's actually stored, which seems
to result in the wrong values in registers when .values is called.  Or, it
would if it didn't have the wrong type when it hit ::toElem.

This only applies to the AA methods that only exist in the AssociativeArray
struct in object.di

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




Commit pushed to master at https://github.com/D-Programming-Language/dmd

https://github.com/D-Programming-Language/dmd/commit/44dae0ddcbdd851f8f73d4332ecfd415a2889e72
fix Issue 5590 - Regression(2.036) ICE(e2ir.c): when using .values on enum
which is associative array

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 03 2012
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=5590


Walter Bright <bugzilla digitalmars.com> changed:

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


-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Mar 03 2012