Thread overview
[Issue 4093] New: Segfault(interpret.c): with recursive struct templates
Apr 15, 2010
Don
Apr 20, 2010
Don
May 06, 2010
Don
Apr 28, 2011
Don
Dec 23, 2011
Don
April 15, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4093

           Summary: Segfault(interpret.c): with recursive struct templates
           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:41:19 PDT ---
struct Zug(int Z){
    const void * bahn = Bug4093!(0).hof.bahn;
}

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

const a = Zug!(0).bahn;
====
crash.d(220): Error: 'this' is only defined in non-static member functions, not
crash
crash.d(220): Error: this for hof needs to be type Bug4093 not type int

-- 
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=4093



--- Comment #1 from Don <clugdbug@yahoo.com.au> 2010-04-20 01:39:08 PDT ---
This bug is completely fixed by the patch to 4094. However, I think this bug does reveal another problem which is also worth fixing.

The segfault itself can also be fixed with this patch to expression.c line 280. The error message it gives is nonsense (so the patch to bug 4094 fixes that), but I think adding more ErrorExps is no bad thing, and may prevent another future crash.


            e1->error("this for %s needs to be type %s not type %s",
                var->toChars(), ad->toChars(), t->toChars());
+            e1 = new ErrorExp();
        }

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


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

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


--- Comment #2 from Don <clugdbug@yahoo.com.au> 2010-05-05 19:10:53 PDT ---
Fixed DMD2.044

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


siegelords_abode@yahoo.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |siegelords_abode@yahoo.com


--- Comment #3 from siegelords_abode@yahoo.com 2010-09-05 08:57:10 PDT ---
The test code in the original comment does not compile on DMD2.048 (Error: variable hof cannot be read at compile time) and causes a segfault in DMD1.063. Is this bug really fixed?

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


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

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


--- Comment #4 from Don <clugdbug@yahoo.com.au> 2011-04-28 06:20:52 PDT ---
Although this bug is fixed in D2, it is NOT fixed for D1 (where it generates a
stack overflow).

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


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

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


--- Comment #5 from Don <clugdbug@yahoo.com.au> 2011-12-23 15:16:04 PST ---
(In reply to comment #4)
> Although this bug is fixed in D2, it is NOT fixed for D1 (where it generates a
> stack overflow).

Don't know why I thought that. This bug never existed on D1. The stack overflow only occurs on a debug version of DMD; on a release DMD, it generates a "recursive template expansion" error. There's no difference between D1 and D2; change the 'const void *' to 'enum void *' to see the D1 behaviour in D2.

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