Thread overview
[Issue 3996] New: Algebraic with struct crashes compiler
Mar 21, 2010
Michel Fortin
[Issue 3996] ICE Regression(2.041): Passing struct as AA template parameter (Algebraic with struct)
Jun 09, 2010
Don
Jun 10, 2010
Don
Jun 15, 2010
Don
Jul 13, 2010
Don
[Issue 3996] Regression(2.041) ICE(glue.c) Passing struct as AA template parameter (Algebraic with struct)
Sep 06, 2010
Don
Sep 11, 2010
Walter Bright
March 21, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3996

           Summary: Algebraic with struct crashes compiler
           Product: D
           Version: 2.041
          Platform: x86_64
        OS/Version: Mac OS X
            Status: NEW
          Severity: major
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: michel.fortin@michelf.com


--- Comment #0 from Michel Fortin <michel.fortin@michelf.com> 2010-03-21 09:51:37 EDT ---
DMD 2.041 and 2.042 on Mac OS X crash with this input. It was working a few versions before, but I don't know exactly at which point it broke.

import std.variant;
struct A {}
alias Algebraic!(A) sts;

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


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |ice-on-valid-code
                 CC|                            |clugdbug@yahoo.com.au
           Platform|x86_64                      |All
            Summary|Algebraic with struct       |ICE Regression(2.041):
                   |crashes compiler            |Passing struct as AA
                   |                            |template parameter
                   |                            |(Algebraic with struct)
         OS/Version|Mac OS X                    |All


--- Comment #1 from Don <clugdbug@yahoo.com.au> 2010-06-09 11:57:21 PDT ---
Reduced test case shows it's a regression from AAs becoming a library type.

template ICE3996(T : V[K], K, V) {}

struct Bug3996 {}

static assert(!is( ICE3996!(Bug3996) ));

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


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|major                       |regression


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



--- Comment #2 from Don <clugdbug@yahoo.com.au> 2010-06-15 07:21:22 PDT ---
I think the root cause of this is bug 4269.

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


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |rsinfu@gmail.com


--- Comment #3 from Don <clugdbug@yahoo.com.au> 2010-07-13 08:14:34 PDT ---
*** Issue 4449 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: -------
September 06, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=3996


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |patch


--- Comment #4 from Don <clugdbug@yahoo.com.au> 2010-09-06 14:01:17 PDT ---
This turns out to be simple. When there's an error in the AA parameters, it
should not continue to instantiate the template.
There's no "error declaration", so return a struct of type TError. Not sure if
it's OK to give it no name.
(Would also be possible to return NULL in this case, but then everything that
calls it would need to be changed, to prevent segfaults).

PATCH(mtype.c): Line 3966

StructDeclaration *TypeAArray::getImpl()
{
    // Do it lazily
    if (!impl)
    {
        Type *index = this->index;
        Type *next = this->next;
        if (index->reliesOnTident() || next->reliesOnTident())
        {
            error(loc, "cannot create associative array %s", toChars());
            index = terror;
            next = terror;
+            StructDeclaration *s = new StructDeclaration(0, NULL);
+            s->type = terror;
+            return s;
        }

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


Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |bugzilla@digitalmars.com
         Resolution|                            |FIXED


--- Comment #5 from Walter Bright <bugzilla@digitalmars.com> 2010-09-11 14:17:47 PDT ---
http://www.dsource.org/projects/dmd/changeset/672

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