← Back to index
|
Original Bugzilla link
Bug 6250 – [CTFE] Crash when swapping two pointers to arrays.
Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-07-04T19:36:00Z
Last change time
2015-06-09T05:11:50Z
Keywords
ice-on-valid-code
Assigned to
nobody
Creator
yebblies
Comments
Comment #0
by yebblies — 2011-07-04T19:36:57Z
void swap(int[]* lhs, int[]* rhs) { *lhs = *rhs; *rhs = *lhs; } int ctfeSort() { int[][2] x; swap(&x[0], &x[1]); return 0; } void main() { enum x = ctfeSort(); } Causes a stack overflow with dmd master (2.054) The same thing happens when using references. void swap(ref int[] lhs, ref int[] rhs) { lhs = rhs; rhs = lhs; } int ctfeSort() { int[][2] x; swap(x[0], x[1]); return 0; } void main() { enum x = ctfeSort(); }
Comment #1
by bugzilla — 2011-07-31T12:08:39Z
https://github.com/D-Programming-Language/dmd/commit/7ef3b2bb9e740df39108957ae5e3b2aa8253d351
https://github.com/D-Programming-Language/dmd/pull/284