[Issue 14257] New: ICE(backend/go.c) with large static foreach
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sat Mar 7 19:04:46 PST 2015
https://issues.dlang.org/show_bug.cgi?id=14257
Issue ID: 14257
Summary: ICE(backend/go.c) with large static foreach
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Keywords: ice-on-valid-code
Severity: normal
Priority: P1
Component: DMD
Assignee: nobody at puremagic.com
Reporter: sinkuupump at gmail.com
DMD fails to optimize code like the following, when foreach aggregate is
staticIota!(0, x >= 100).
Reduced test case:
template TypeTuple(TList...)
{
alias TypeTuple = TList;
}
package template staticIota(int beg, int end)
{
static if (beg + 1 >= end)
{
static if (beg >= end)
{
alias staticIota = TypeTuple!();
}
else
{
alias staticIota = TypeTuple!(+beg);
}
}
else
{
enum mid = beg + (end - beg) / 2;
alias staticIota = TypeTuple!(staticIota!(beg, mid), staticIota!(mid,
end));
}
}
void test()
{
int row;
foreach (s; staticIota!(0, 100))
{
if (++row) row = 0;
}
}
$ dmd -O -c test.d
Internal error: backend/go.c 242
--
More information about the Digitalmars-d-bugs
mailing list