Bug 14304 – [REG2.067a] ICE with static immutable variable CTFE

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-03-18T07:35:00Z
Last change time
2015-06-17T21:02:29Z
Keywords
ice, pull
Assigned to
nobody
Creator
kozzi11

Comments

Comment #0 by kozzi11 — 2015-03-18T07:35:09Z
immutable struct Bug { string s_name; alias s_name this; string opBinary(string op, V)(V tValue) { return ""; } } class Buggy { static string fun(string str)() { return str; } static immutable C_A = immutable Bug("c_a"); } void main(string[] args) { enum kt = Buggy.fun!(Buggy.C_A); enum bt = Buggy.C_A ~ " - "; }
Comment #1 by code — 2015-03-18T08:23:48Z
Seems like it silently failed to work in 2.065. http://dpaste.dzfl.pl/11192e1b84d7 You know whether that worked with 2.066.1? If so please change the importance to regression.
Comment #2 by dlang-bugzilla — 2015-03-18T12:45:37Z
Comment #3 by k.hara.pg — 2015-03-20T01:18:08Z
The occurred ICE (moved from the summary): dmd: interpret.c:6724: void setValue(VarDeclaration*, Expression*): Assertion `(vd->storage_class & (0x1000LL | 0x200000LL)) ? isCtfeReferenceValid(newval) : isCtfeValueValid(newval)' failed. Compiler fix: https://github.com/D-Programming-Language/dmd/pull/4503
Comment #4 by github-bugzilla — 2015-03-20T03:31:39Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/9a6b349c3d9a1d991d429714c00fd103048ca792 fix Issue 14304 - ICE with static immutable variable CTFE https://github.com/D-Programming-Language/dmd/commit/6d8634bf1421be51413e5ba87154f5adf4bc7e30 Reduce memory space for CTFE The prior fix for issue 14304 is simple, but it will also increase the amount of memory space for CTFE (and actually breaks Phobos unittest in Windows platform). To fix performance issue without breaking CTFE behavior: - Mark the cached value of non-mutable static variable specially, to represent "read-only constant". - Prevent modifications of "read-only constant". - Once a value is owned by CTFE (including cached ones), we can avoid redundant copies for that, because the expression object can be used directly during interpretation. https://github.com/D-Programming-Language/dmd/commit/06537bcd9128b948a1feb35b4fd5e3cdd55c201c Merge pull request #4503 from 9rnsr/fix14304 [REG2.067a] Issue 14304 - ICE with static immutable variable CTFE
Comment #5 by github-bugzilla — 2015-03-20T12:00:35Z
Commit pushed to 2.067 at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/6d8e462040aa3fd2fb2fb0848436ec3a493aac56 Merge pull request #4503 from 9rnsr/fix14304 [REG2.067a] Issue 14304 - ICE with static immutable variable CTFE
Comment #6 by code — 2015-03-24T13:31:31Z
*** Issue 14314 has been marked as a duplicate of this issue. ***
Comment #7 by github-bugzilla — 2015-04-11T12:25:10Z
Comment #8 by github-bugzilla — 2015-06-17T21:02:29Z