[Issue 20218] New: Checked format string takes infinite time for infinite ranges
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Sep 16 21:44:01 UTC 2019
https://issues.dlang.org/show_bug.cgi?id=20218
Issue ID: 20218
Summary: Checked format string takes infinite time for infinite
ranges
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Severity: normal
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: acehreli at yahoo.com
dmd 2.088 does not stop compiling the following program seemingly because it is
expanding the infinite range at compile time:
import std.string;
import std.range;
void main() {
format!"%s"(1.repeat);
}
1) SAME PROBLEM for writefln
2) SAME PROBLEM for element formatters %( and %):
format!"%(%s%)"(1.repeat);
3) SIMILAR PROBLEM: Apparently, it can take "close to infinite time" if the
range is large. The following line either does not finish compilation or takes
a very long time (I did not wait):
format!"%s"(1.repeat(1_000_000_000));
Ali
--
More information about the Digitalmars-d-bugs
mailing list