Thread overview
[Issue 8691] New: Stack overflow with recursive struct
Oct 05, 2012
Andrej Mitrovic
Oct 05, 2012
Andrej Mitrovic
September 19, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=8691

           Summary: Stack overflow with recursive struct
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: bearophile_hugs@eml.cc


--- Comment #0 from bearophile_hugs@eml.cc 2012-09-18 20:07:01 PDT ---
struct Foo {
    Foo[1] foos;
}
void main() {}



DMD 2.061alpha shows:

Stack overflow

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


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich@gmail.com


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-10-04 17:49:56 PDT ---
I can fix this but I need a little help with the error implementation. After adding a check I end up with:

mymod.d(3): Error: struct test.Foo cannot have field foos with same struct type
mymod.d(3): Error: struct test.Foo cannot have field foos with same struct type
mymod.d(3): Error: struct test.Foo cannot have field foos with same struct type
mymod.d(3): Error: struct test.Foo cannot have field foos with same struct type
mymod.d(3): Error: struct test.Foo cannot have field foos with same struct type
mymod.d(3): Error: struct test.Foo cannot have field foos with same struct type
mymod.d(3): Error: struct test.Foo cannot have field foos with same struct type
mymod.d(3): Error: struct test.Foo cannot have field foos with same struct type
mymod.d(3): Error: struct test.Foo cannot have field foos with same struct type
mymod.d(3): Error: struct test.Foo cannot have field foos with same struct type
mymod.d(3): Error: struct test.Foo cannot have field foos with same struct type
mymod.d(3): Error: struct test.Foo cannot have field foos with same struct type
mymod.d(3): Error: struct test.Foo cannot have field foos with same struct type
mymod.d(3): Error: struct test.Foo cannot have field foos with same struct type
mymod.d(3): Error: struct test.Foo cannot have field foos with same struct type
mymod.d(3): Error: struct test.Foo cannot have field foos with same struct type
mymod.d(3): Error: struct test.Foo cannot have field foos with same struct type
mymod.d(3): Error: struct test.Foo cannot have field foos with same struct type
mymod.d(3): Error: struct test.Foo cannot have field foos with same struct type
mymod.d(3): Error: struct test.Foo cannot have field foos with same struct type
mymod.d(3): Error: struct test.Foo cannot have field foos with same struct type

Anyone savvy enough with DMD knows how to avoid spawning so much errors?

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



--- Comment #2 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2012-10-04 17:53:57 PDT ---
(In reply to comment #1)
> I can fix this but I need a little help with the error implementation. After adding a check I end up with:

Ok I think I've got it, making pull shortly..

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


bearophile_hugs@eml.cc changed:

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


--- Comment #3 from bearophile_hugs@eml.cc 2012-10-06 03:48:43 PDT ---
Closed. See: https://github.com/D-Programming-Language/dmd/commit/77c0f9d97f91b606a1b6c209dc5a9d7f32d061cb

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