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(); }
Comment #3 by k.hara.pg — 2015-01-14T16:07:42Z
This is a backend codegen regression from 2.063, introduced in: https://github.com/D-Programming-Language/dmd/pull/1893
Comment #4 by bugzilla — 2015-01-31T22:36:32Z
Further reduction: struct Foo { int x, y; } int xxx(const Foo* f) { return 0 % ((f.y > 0) ? f.x / f.y : f.x / -f.y); }
Comment #5 by bugzilla — 2015-02-01T05:54:04Z
Comment #6 by github-bugzilla — 2015-02-01T06:29:55Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/02f8cde5973b7cfc2e24e41e893068e4947edf06 fix Issue 13969 - [REG2.063] [ICE] (backend\cgcod.c 2309) with cycle(iota(a,b,s)) https://github.com/D-Programming-Language/dmd/commit/e542e145b9fac61233e98f9188532a563d62eda7 Merge pull request #4364 from WalterBright/fix13969 [REG]: fix Issue 13969 - [ICE] (backend\cgcod.c 2309) with cycle(iota(a,b,s))