Thread overview
[Issue 4094] New: ICE(expression.c): recursive struct templates with type inference
Apr 15, 2010
Don
Apr 20, 2010
Don
Apr 27, 2010
Walter Bright
Feb 19, 2013
Kenji Hara
Feb 19, 2013
Kenji Hara
April 15, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4094

           Summary: ICE(expression.c): recursive struct templates with
                    type inference
           Product: D
           Version: 2.040
          Platform: Other
        OS/Version: Windows
            Status: NEW
          Keywords: ice-on-invalid-code
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: clugdbug@yahoo.com.au


--- Comment #0 from Don <clugdbug@yahoo.com.au> 2010-04-15 11:43:16 PDT ---
A simple variation of bug 4093.

struct Zug(int Z){
    const bahn = Bug4094!(0).hof.bahn;
}

struct Bug4094(int Q){
    Zug!(0) hof;
}

const a = Zug!(0).bahn;
---------
Assertion failure: 'type' on line 6192 in file 'expression.c'

abnormal program termination

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


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

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


--- Comment #1 from Don <clugdbug@yahoo.com.au> 2010-04-20 01:33:24 PDT ---
mtype.c, TypeStruct::dotExp line 6645. Should not be able to declare a variable in terms of itself. This can be detected via the 'inuse' member of the VarDeclaration. Something I don't really like about this is that it introduces a long-range coupling into the code (the 'inuse' member is not well documented, and it's also used for a completely different purpose in toDecoBuffer()).

Note that this patch also fixes bug 4093, and various other kinds of recursive definitions (the existing cases which don't ICE just loop until the stack overflow probe catches them, generating a "recursive template definition" error message).

===

    if (v && !v->isDataseg())
    {

        Expression *ei = v->getConstInitializer();
        if (ei)
        {   e = ei->copy();     // need to copy it if it's a StringExp
+            if (v->inuse)
+            {
+                v->error("recursive declaration");
+                return new ErrorExp();
+            }
            e = e->semantic(sc);
            return e;
        }
    }

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


Walter Bright <bugzilla@digitalmars.com> changed:

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


--- Comment #2 from Walter Bright <bugzilla@digitalmars.com> 2010-04-26 17:38:01 PDT ---
When I try this patch, the bug remains.

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


Kenji Hara <k.hara.pg@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull


--- Comment #3 from Kenji Hara <k.hara.pg@gmail.com> 2013-02-18 20:30:00 PST ---
The root cause is just same as bug 9494.

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

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


Kenji Hara <k.hara.pg@gmail.com> changed:

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


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