www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 4604] New: A stack overflow with writeln

reply d-bugmail puremagic.com writes:
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



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: -------
Aug 09 2010
next sibling parent d-bugmail puremagic.com writes:
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: -------
Jan 09 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=4604




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: -------
Jun 06 2011
prev sibling parent d-bugmail puremagic.com writes:
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



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: -------
Feb 24 2012