Bug 12769 – ICE returning array

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-05-19T17:31:00Z
Last change time
2014-05-20T07:17:03Z
Keywords
ice, pull
Assigned to
nobody
Creator
turkeyman

Comments

Comment #0 by turkeyman — 2014-05-19T17:31:40Z
float[] f(float[] a) { return -a[]; } Internal error: e2ir.c 1834 DMD 2.065 w/ -m64 Here's what I was actually trying to do at the time: float[4] f(float[4] a) { return (-a[])[0..4]; } Here's another permutation. It'd be nice if it could work out what '$' was at compile time: float[4] f(float[4] a) { return (-a[])[0..$]; // use dollar instead of explicit '4' } Error: cannot implicitly convert expression ((-a[])[0..__dollar]) of type float[] to float[4] Ideally, this should work with static arrays: float[4] f(float[4] a) { return -a; } requiring a[] causes a to become a dynamic array, and then it can't be assigned back to a static array anymore. It all goes south for array operations on static arrays with [].
Comment #1 by k.hara.pg — 2014-05-20T03:43:09Z
Comment #2 by k.hara.pg — 2014-05-20T03:49:23Z
(In reply to Manu from comment #0) > requiring a[] causes a to become a dynamic array, and then it can't be > assigned back to a static array anymore. It all goes south for array > operations on static arrays with []. In my humble opinion, if the boundaries of an array operation could be known at compile-time, the array-op result should be convertible to static array type. Could you file it as a new enhancement issue?
Comment #3 by turkeyman — 2014-05-20T05:31:44Z
Comment #4 by k.hara.pg — 2014-05-20T06:53:43Z
This is a regression issue from 2.065.
Comment #5 by k.hara.pg — 2014-05-20T06:53:48Z
*** Issue 12772 has been marked as a duplicate of this issue. ***
Comment #6 by github-bugzilla — 2014-05-20T07:17:03Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/1345532ca75a0b0f041941f3b6a6f58fe9a25aec fix Issue 12769 - ICE returning array https://github.com/D-Programming-Language/dmd/commit/caa9c184fa2fa566d817dbccc6827a5e2f810884 Merge pull request #3559 from 9rnsr/fix12769 [REG2.065] Issue 12769 - ICE returning array