Bug 9852 – Empty associative array crashes program

Status
RESOLVED
Resolution
FIXED
Severity
critical
Priority
P2
Component
druntime
Product
D
Version
D2
Platform
x86_64
OS
All
Creation time
2013-04-01T13:15:00Z
Last change time
2013-07-08T17:12:26Z
Keywords
pull
Assigned to
nobody
Creator
luis

Comments

Comment #0 by luis — 2013-04-01T13:15:55Z
#!/usr/local/bin/rdmd @safe: void main() { int[string] a; a["foo"] = 0; a.remove("foo"); assert(a != null); } --- $ ./test.d Segmentation fault: 11 -- System: DMD64 D Compiler v2.062 Darwin feynman 12.3.0 Darwin Kernel Version 12.3.0: Sun Jan 6 22:37:10 PST 2013; root:xnu-2050.22.13~1/RELEASE_X86_64 x86_64
Comment #1 by luis — 2013-04-01T16:52:41Z
Not a bug. Oops, sorry, I was dense today (and forgotten about D).
Comment #2 by bearophile_hugs — 2013-04-01T17:07:13Z
Reopened, because Steven Schveighoffer has said: > The equals operator should check for null before comparing > the contents. It is a valid bug.
Comment #3 by maxim — 2013-04-01T22:06:54Z
It can be reproduced on linux, removing os specific tag, raising importance. I think this is a druntime bug rather than dmd.
Comment #4 by schveiguy — 2013-04-03T09:44:30Z
(In reply to comment #3) > I think this is a druntime bug rather than dmd. You are correct. Updating.
Comment #5 by hsteoh — 2013-07-08T15:01:17Z
Comment #6 by github-bugzilla — 2013-07-08T17:03:17Z
Commits pushed to master at https://github.com/D-Programming-Language/druntime https://github.com/D-Programming-Language/druntime/commit/64679623a321f69ef28feb482711fd5a85cb1d39 Fix issue 9852. _aaEqual should not dereference null when given a null AA. https://github.com/D-Programming-Language/druntime/commit/33b1c818cbde36e5c6d721faf791beeacaee9fb1 Merge pull request #541 from quickfur/issue9852 Fix issue 9852.