← Back to index
|
Original Bugzilla link
Bug 14104 – aa with pointer key type doesn't find existing value
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-02-01T19:12:00Z
Last change time
2015-06-09T05:14:48Z
Keywords
pull
Assigned to
nobody
Creator
code
Comments
Comment #0
by code — 2015-02-01T19:12:45Z
Found in Higgs, apparently introduced by
https://github.com/D-Programming-Language/dmd/pull/4159.
The key type is const(ubyte)*. I tracked it down to differing TypeInfos. On insertion it's TypeInfo_Pointer [1] for opIn it's TypeInfo_P [2]. The latter computes a different hash. [1]:
https://github.com/D-Programming-Language/druntime/blob/f0c1e13d8bd547eed517b1ae17f085966bb165c1/src/object_.d#L361
[2]:
https://github.com/D-Programming-Language/druntime/blob/2024ca6d3e29362a2fc84ef51c0f73316259d645/src/rt/typeinfo/ti_ptr.d#L18
Comment #1
by code — 2015-02-01T19:35:05Z
https://github.com/D-Programming-Language/druntime/pull/1150
Comment #2
by r.sagitario — 2015-02-01T19:48:01Z
Here's small test case for 64-bit: void main() { int[const(ubyte)*] aa; const(ubyte)* p = cast(const(ubyte)*) 0x1_0000_0000; aa[p] = 1; assert(aa[p] == 1); assert(p in aa); }
Comment #3
by github-bugzilla — 2015-02-02T02:53:26Z
Commits pushed to master at
https://github.com/D-Programming-Language/druntime
https://github.com/D-Programming-Language/druntime/commit/cc8046dd390a974e57a8062e2fb98402726208e7
fix Issue 14104 - aa with pointer key type doesn't find existing value - the internal TypeInfo_P.getHash for pointers trucated the hash to 32-bit unlike the TypeInfo_Pointer.getHash - internal TypeInfos are used when no full type information is needed so they must behave identical
https://github.com/D-Programming-Language/druntime/commit/86f8b7cd760ac1b21059f9953d58569808eeec09
Merge pull request #1150 from MartinNowak/fix14104 fix Issue 14104 - aa with pointer key type doesn't find existing value
Comment #4
by github-bugzilla — 2015-02-07T16:21:13Z
Commit pushed to master at
https://github.com/D-Programming-Language/dmd
https://github.com/D-Programming-Language/dmd/commit/13d0da1e7ec9a02bf7757e6d1cf6470f59cf6ff5
Merge pull request #4389 from rainers/issue14104 fix issue 14104 - nuke getInternalTypeInfo
Comment #5
by github-bugzilla — 2015-02-07T20:38:30Z
Commit pushed to
https://github.com/D-Programming-Language/dmd
https://github.com/D-Programming-Language/dmd/commit/13d0da1e7ec9a02bf7757e6d1cf6470f59cf6ff5
Merge pull request #4389 from rainers/issue14104
Comment #6
by github-bugzilla — 2015-02-18T03:38:59Z
Commits pushed to 2.067 at
https://github.com/D-Programming-Language/druntime
https://github.com/D-Programming-Language/druntime/commit/cc8046dd390a974e57a8062e2fb98402726208e7
fix Issue 14104 - aa with pointer key type doesn't find existing value
https://github.com/D-Programming-Language/druntime/commit/86f8b7cd760ac1b21059f9953d58569808eeec09
Merge pull request #1150 from MartinNowak/fix14104
Comment #7
by code — 2015-02-19T00:50:44Z
*** Issue 14182 has been marked as a duplicate of this issue. ***