Thread overview
[Issue 4604] New: A stack overflow with writeln
Feb 24, 2012
Dmitry Olshansky
August 09, 2010
http://d.puremagic.com/issues/show_bug.cgi?id=4604

           Summary: A stack overflow with writeln
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: nobody@puremagic.com
        ReportedBy: bearophile_hugs@eml.cc


--- Comment #0 from bearophile_hugs@eml.cc 2010-08-09 07:55:24 PDT ---
With dmd 2.048beta this program:

import std.stdio, std.regex, std.array;
void main() {
    writeln(array(match("1", regex(r"\d")).captures));
}


prints:
[1]


While this wrong program:

import std.stdio, std.regex, std.array;
void main() {
    writeln(array(match("1", regex(r"\d"))));
}


Produces:

object.Error: Stack Overflow [[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[[...]

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


Andrei Alexandrescu <andrei@metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
                 CC|                            |andrei@metalanguage.com
         AssignedTo|nobody@puremagic.com        |andrei@metalanguage.com


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



--- Comment #1 from bearophile_hugs@eml.cc 2011-06-06 11:09:15 PDT ---
Dmitry Olshansky has suggested me to add this that comes from issue 4627:

To me this program crashes at runtime (DMD 2.053):


import std.stdio, std.regex;
void main() {
    foreach (m; match("125 155 ss25", r"\d+"))
        writeln(m);
}


If I use this line it works:
writeln(m.toString());

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


Dmitry Olshansky <dmitry.olsh@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |RESOLVED
                 CC|                            |dmitry.olsh@gmail.com
         Resolution|                            |FIXED


--- Comment #2 from Dmitry Olshansky <dmitry.olsh@gmail.com> 2012-02-24 11:42:34 PST ---
Now it works as expected but without .toString (which is OK IMHO there is no
toString documented).
Since 2.056+ most likely.

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