Bug 17876 – [REG 2.074] Internal error when comparing inout(Foo[][]) with Foo[][]

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-10-04T19:44:02Z
Last change time
2017-10-09T16:52:22Z
Keywords
ice, pull
Assigned to
No Owner
Creator
Christian DurĂ¡n

Comments

Comment #0 by ovejacuantica — 2017-10-04T19:44:02Z
Not sure if a problem with phobos or druntime. import std.container.rbtree; void main () { auto a = redBlackTree!(size_t [][]); } With command 'dmd file' or 'ldc file' (DMD 2.076.0 and LDC 1.4.0) gives: /usr/include/dlang/dmd/object.d(3462): Error: static assert "Internal error." /usr/include/dlang/dmd/std/functional.d-mixin-201(201): instantiated from here: __cmp!(const(ulong[]), ulong[]) /usr/include/dlang/dmd/std/container/rbtree.d(866): instantiated from here: binaryFun!(inout(ulong[][]), ulong[][]) /usr/include/dlang/dmd/std/container/rbtree.d(1832): instantiated from here: RedBlackTree!(ulong[][], "a < b", false)
Comment #1 by ovejacuantica — 2017-10-04T19:52:32Z
Probably just needs a better error message because it seems to happen because there's no ordering for the type.
Comment #2 by ag0aep6g — 2017-10-04T20:37:30Z
Reduced (it's the result of using `binaryFun!"a < b"` in the `inout` method `_firstGreaterEqual`): ---- bool _less(inout size_t[][] a, size_t[][] b) { return a < b; } ---- I don't know if this should compile or throw an error. Any way, it shouldn't ICE. dmd2.073.0 accepts the code, making this a regression. Changing component to dmd as that's where the bug manifests as an ICE. The actual bug might be in druntime.
Comment #3 by schveiguy — 2017-10-05T13:24:44Z
this should compile, size_t[][] has a valid ordering. If the ice is fixed, and this doesn't compile, please file another bug report.
Comment #4 by r.sagitario — 2017-10-08T13:16:07Z
Comment #5 by github-bugzilla — 2017-10-09T11:06:40Z
Commits pushed to stable at https://github.com/dlang/druntime https://github.com/dlang/druntime/commit/70d536eddf2bab82e428ea397dec8b4093c9f3c1 fix Issue 17876 - moved bad assertion that failed for arrays of arrays with mixed modifiers to the memcmp version which should work on values anyway. Also fixed bad comparison via memcmp only comparing first element. https://github.com/dlang/druntime/commit/ec9a79e15d446863191308fd5e20febce2053546 Merge pull request #1934 from rainers/issue_17876 fix Issue 17876 - [REG 2.074] Internal error when comparing inout(Foo[][]) with Foo[][]
Comment #6 by github-bugzilla — 2017-10-09T16:52:22Z
Commits pushed to master at https://github.com/dlang/druntime https://github.com/dlang/druntime/commit/70d536eddf2bab82e428ea397dec8b4093c9f3c1 fix Issue 17876 - moved bad assertion that failed for arrays of arrays with mixed modifiers to the memcmp version which should work on values anyway. https://github.com/dlang/druntime/commit/ec9a79e15d446863191308fd5e20febce2053546 Merge pull request #1934 from rainers/issue_17876