Bug 17964 – [CTFE] If array is large enough it hits __simd at CTFE
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-11-03T15:43:44Z
Last change time
2018-05-17T04:34:13Z
Keywords
pull
Assigned to
No Owner
Creator
Dmitry Olshansky
Comments
Comment #0 by dmitry.olsh — 2017-11-03T15:43:44Z
Array ops used to work at CTFE, now:
uint bug(){
uint[] a = [1, 2, 3, 5, 6, 7];
uint[] b = [1, 2, 3, 5, 6, 7];
a[] |= ~b[];
return a[1];
}
enum x = bug();
Produces on a recent master (1fa67d062b8d755b11722ea112af63cb34cc06b7):
/home/olshanskiy/dmd2/linux/bin64/../../src/druntime/import/core/internal/arrayop.d(102): Error: __simd cannot be interpreted at compile time, because it has no available source code
/home/olshanskiy/dmd2/linux/bin64/../../src/druntime/import/core/internal/arrayop.d-mixin-50(50): called from here: load(&res[pos])
/home/olshanskiy/dmd2/linux/bin64/../../src/druntime/import/core/internal/arrayop.d-mixin-50(50): called from here: binop(load(&res[pos]), unaop(load(&_param_1[pos])))
/home/olshanskiy/dmd2/linux/bin64/../../src/druntime/import/core/internal/arrayop.d-mixin-50(50): called from here: store(&res[pos], binop(load(&res[pos]), unaop(load(&_param_1[pos]))))
bug.d(5): called from here: arrayOp(a[], b[])
bug.d(9): called from here: bug()
Comment #1 by uplink.coder — 2017-11-06T11:09:11Z
What needs to be done here is a change in druntime/src/core/internal/arrayops.d adding a __ctfe branch to load and store which works without simd intrinsics.
I will take this if it is not fixed by the end of the week