Bug 14192 – Access Violation when assigning to shared AA

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-02-17T11:36:00Z
Last change time
2017-07-19T17:38:37Z
Keywords
pull
Assigned to
nobody
Creator
mrsmith33

Comments

Comment #0 by mrsmith33 — 2015-02-17T11:36:25Z
unittest { shared int[int] _map; _map[1] = 1; } --------------------------- Error --------------------------- object.Error@(0): Access Violation ---------------- 0x0052E494 in _aaGetImpl druntime 3f99ef5 dmd f47c8f60 phobos ed896ca21
Comment #1 by mrsmith33 — 2015-02-17T12:12:58Z
stack trace object.Error@(0): Access Violation ---------------- 0x0040322F in _aaGetImpl at D:\D\digger\repo\druntime\src\rt\aaA.d(215) 0x00402381 in _aaGetY at D:\D\digger\repo\druntime\src\rt\aaA.d(189) 0x0040203D in void test.__unittestL1_1() at D:\D\test.d(3) 0x00402068 in void test.__modtest() at D:\D\test.d(4)
Comment #2 by schveiguy — 2015-02-17T14:50:38Z
It's because of the precise scanning. DMD passes the type info to _aaGetY, which is actually a wrapper TypeInfo_Shared, but the function is prototyped as accepting TypeInfo_AssociativeArray. See my comment here: https://github.com/D-Programming-Language/druntime/pull/1037#issuecomment-74678635
Comment #3 by schveiguy — 2015-02-17T14:51:43Z
Note, the unittest is incidental, it happens with just: void main() { shared int[int] aa; aa[1] = 1; }
Comment #4 by k.hara.pg — 2015-02-17T15:14:27Z
(In reply to Steven Schveighoffer from comment #2) > It's because of the precise scanning. DMD passes the type info to _aaGetY, > which is actually a wrapper TypeInfo_Shared, but the function is prototyped > as accepting TypeInfo_AssociativeArray. > > See my comment here: > https://github.com/D-Programming-Language/druntime/pull/1037#issuecomment- > 74678635 The root is mostly same with issue 14038.
Comment #5 by code — 2015-02-19T02:11:49Z
Comment #6 by code — 2015-02-19T02:15:00Z
A shared AA doesn't make too much sense BTW, because you'll need some additional synchronization mechanism if you want to modify it. And if you use a http://dlang.org/phobos/core_sync_rwmutex.html#.ReadWriteMutex for example you only need tail-shared for the value type.
Comment #7 by github-bugzilla — 2015-02-19T08:53:56Z
Commits pushed to master at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/5afc1177551fa8f6e43bb1fc499698eaab41655a fix Issue 14192 - Access Violation when assigning to shared AA - the runtime expects an unqualified TypeInfo for the AA and crashes if it is wrapped inside a TypeInfo_Shared https://github.com/D-Programming-Language/dmd/commit/4091ddc1af08f3a65512e41a19ffda06335471c2 Merge pull request #4420 from MartinNowak/fix14192 fix Issue 14192 - Access Violation when assigning to shared AA
Comment #8 by github-bugzilla — 2015-02-20T00:16:34Z
Commit pushed to 2.067 at https://github.com/D-Programming-Language/dmd https://github.com/D-Programming-Language/dmd/commit/2077a7fc4a3842030ef2df7429d0e225242443a0 Merge pull request #4420 from MartinNowak/fix14192 fix Issue 14192 - Access Violation when assigning to shared AA
Comment #9 by github-bugzilla — 2015-02-21T09:11:46Z
Comment #10 by github-bugzilla — 2015-04-11T12:24:42Z
Comment #11 by github-bugzilla — 2015-06-17T21:00:53Z
Comment #12 by github-bugzilla — 2017-07-19T17:38:37Z
Commits pushed to dmd-cxx at https://github.com/dlang/dmd https://github.com/dlang/dmd/commit/5afc1177551fa8f6e43bb1fc499698eaab41655a fix Issue 14192 - Access Violation when assigning to shared AA https://github.com/dlang/dmd/commit/4091ddc1af08f3a65512e41a19ffda06335471c2 Merge pull request #4420 from MartinNowak/fix14192