Bug 13969 – [REG2.063] [ICE] (backend\cgcod.c 2309) with cycle(iota(a,b,s))
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-01-12T11:13:00Z
Last change time
2015-02-01T06:29:55Z
Keywords
ice
Assigned to
nobody
Creator
bearophile_hugs
Comments
Comment #0 by bearophile_hugs — 2015-01-12T11:13:16Z
void main() {
import std.range: iota, cycle;
auto c = cycle(iota(3, 0, -1));
}
Internal error: backend\cgcod.c 2309
I compile with:
dmd -O -inline test.d
Comment #1 by k.hara.pg — 2015-01-14T06:54:38Z
Reduced test case (remove dependency to Phobos):
struct IotaResult
{
int pastLast;
int step;
size_t length() const
{
if (step > 0)
return pastLast / step;
else
return pastLast / -step;
}
}
struct Cycle
{
IotaResult _original;
size_t _index;
this(IotaResult input, size_t i = 0)
{
_index = i % _original.length();
}
}
void main()
{
auto c = Cycle(IotaResult(0, -1));
}
Comment #2 by bearophile_hugs — 2015-01-14T08:22:46Z
(In reply to Kenji Hara from comment #1)
> Reduced test case (remove dependency to Phobos):
Further reduction:
struct Foo {
int x, y;
int bar() const {
if (y > 0)
return x / y;
else
return x / -y;
}
}
Foo f;
int n;
void main() {
n = 0 % f.bar();
}