Bug 7107 – Compiled program aborts when using foreach and std.regex.splitter

Status
RESOLVED
Resolution
WORKSFORME
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2011-12-14T04:07:00Z
Last change time
2014-05-07T18:21:50Z
Assigned to
nobody
Creator
ttanjo

Attachments

IDFilenameSummaryContent-TypeSize
1052output.logThe output of the compiled programtext/x-log3425

Comments

Comment #0 by ttanjo — 2011-12-14T04:07:20Z
Created attachment 1052 The output of the compiled program When I compiled the following code with DMD v2.057 with -inline option, the compiled program aborts in runtime (on Linux 64bit). When I use regex("h") or regex(" ") instead of regex(" "), this code works correctly. issue.d: ---------------------------------------------------- import std.regex; import std.stdio; void main() { foreach(w; splitter("hoge fuga", regex(" "))) { writeln(w); writeln(w.length); } } ---------------------------------------------------- I attached the output of the compiled program.
Comment #1 by k.hara.pg — 2011-12-14T04:26:02Z
This problem does not occurs in Windows 7 64bit. Output is: ---- hoge fuga 9 ----
Comment #2 by dmitry.olsh — 2012-04-19T10:52:44Z
Can't reproduce with 2.059 on Fedora x86_64. I tried: dmd x.d dmd -inline -O x.d dmd -m64 -inline -O x.d dmd -m64 -inline x.d All work. It's either a problem with your specific setup or it was fixed somewhere between 2.057-2.059.
Comment #3 by github-bugzilla — 2014-05-07T18:21:50Z
Commit pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/33f2ab82bd9fb51d88927b8048d88c30ea44111e Remove code for bug 7107 and 10296 because they are unnecessary anymore. Now instantiated symbols can reach correct "parent" via `Dsymbol::toParent2()`, because `TemplateInstance::enclosing` is properly calculated in `TemplateInstance::hasNestedArgs`.