Thread overview
[Issue 9280] New: Runtime range violation with named capture groups in regex
Jan 08, 2013
Dmitry Olshansky
Mar 10, 2013
Dmitry Olshansky
Mar 10, 2013
Dmitry Olshansky
Mar 11, 2013
David Nadlinger
Mar 18, 2013
Dmitry Olshansky
January 08, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=9280

           Summary: Runtime range violation with named capture groups in
                    regex
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody@puremagic.com
        ReportedBy: nine5102@lantea.net


--- Comment #0 from nine5102@lantea.net 2013-01-07 19:05:56 PST ---
Created an attachment (id=1177)
Source code for test case

Given the attached code (also available at https://gist.github.com/5a0b4685c6d316620c86 ) there is a range error when trying to access a named capture group when using a static regex object.

When removing static from the declaration of the regex object there is no range error on runtime.

The attached test case is run as follows.

$ dmd -run regex.d
c[1]      = a
c["nick"] = a

$ dmd -version=Static -run regex.d
c[1]      = a
core.exception.RangeError@std.regex(2145): Range violation
----------------
regex(_d_array_bounds+0x16) [0x80c9746]
regex() [0x80ce916]
regex(@trusted uint
std.regex.lookupNamedGroup!(immutable(char)[]).lookupNamedGroup(std.regex.NamedGroup[],
immutable(char)[])+0x5a) [0x80c5002]
regex(@trusted immutable(char)[] std.regex.Captures!(immutable(char)[],
uint).Captures.opIndex!(immutable(char)[]).opIndex(immutable(char)[])+0x48)
[0x80c4f20]
regex(_Dmain+0xa5) [0x809ef79]
regex(extern (C) int rt.dmain2.main(int, char**).void runMain()+0x14)
[0x80c9d20]
regex(extern (C) int rt.dmain2.main(int, char**).void tryExec(scope void
delegate())+0x18) [0x80c9830]
regex(extern (C) int rt.dmain2.main(int, char**).void runAll()+0x32)
[0x80c9d62]
regex(extern (C) int rt.dmain2.main(int, char**).void tryExec(scope void
delegate())+0x18) [0x80c9830]
regex(main+0x94) [0x80c97e4]
/lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xf3) [0xb75c94d3]
----------------

The bug appears on both dmd 2.059 (on ubuntu) and dmd 2.061 (on archlinux).

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


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dmitry.olsh@gmail.com


--- Comment #1 from Dmitry Olshansky <dmitry.olsh@gmail.com> 2013-01-08 02:25:24 PST ---
Seems like a duplicate of Issue 8529 ?

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


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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |wyrlon@gmx.net


--- Comment #2 from Dmitry Olshansky <dmitry.olsh@gmail.com> 2013-03-10 00:56:11 PST ---
*** Issue 8529 has been marked as a duplicate of this issue. ***

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


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

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


--- Comment #3 from Dmitry Olshansky <dmitry.olsh@gmail.com> 2013-03-10 01:05:55 PST ---
https://github.com/D-Programming-Language/phobos/pull/1194

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



--- Comment #4 from github-bugzilla@puremagic.com 2013-03-11 16:54:58 PDT ---
Commit pushed to master at https://github.com/D-Programming-Language/phobos

https://github.com/D-Programming-Language/phobos/commit/be25fd00b1770aab17eca98deccacc08f55c73be fix Issue 9280

A bug in _ctfe branch that was introduced while stubbing out non-CTFeable
blocks.
Now CTFE is having more power and able to run the same code just fine!

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


David Nadlinger <code@klickverbot.at> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |code@klickverbot.at


--- Comment #5 from David Nadlinger <code@klickverbot.at> 2013-03-11 16:56:12 PDT ---
Should be fixed in Git master.

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


Dmitry Olshansky <dmitry.olsh@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: -------