[Issue 19391] New: [ICE] static array comparison
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Nov 12 00:19:14 UTC 2018
https://issues.dlang.org/show_bug.cgi?id=19391
Issue ID: 19391
Summary: [ICE] static array comparison
Product: D
Version: D2
Hardware: x86
OS: All
Status: NEW
Severity: regression
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: iamthewilsonator at hotmail.com
see this commit[1] which worked around it
[1]:https://github.com/libmir/mir-algorithm/commit/c804962c99467168484dbf084bbe491bcd2da2a7
---
auto slice = iota(2, 3).universal.assumeContiguous;
...
- assert(slice._strides == []); // <<< Crashes
+ static assert(slice._strides.length == 0); // the workaround
---
slice._strides is an alias to the second member of a tuple, which somehow ends
up wrongly having the type const(long[1]) outside of CTFE (since the static
assert passes) which when compared for equality to [] (which is inferred as
long[0]) fails in e2ir.d when DMD tries to optimise the comparison to a memcmp
because the size of the two arrays do not match, tripping an assert[2]
assert(t1.size() == t2.size()); where t1,t2 are the type of the static arrays.
[2]: https://github.com/dlang/dmd/blob/master/src/dmd/e2ir.d#L2436
--
More information about the Digitalmars-d-bugs
mailing list