* libgo patch committed: Permit delete from map with zero length key
@ 2014-12-13 1:58 Ian Lance Taylor
0 siblings, 0 replies; only message in thread
From: Ian Lance Taylor @ 2014-12-13 1:58 UTC (permalink / raw)
To: gcc-patches, gofrontend-dev
[-- Attachment #1: Type: text/plain, Size: 266 bytes --]
A map with a zero length key is useless, but valid. gccgo was
incorrectly crashing when deleting an entry from such a map. This
patch by Chris Manghane fixes the problem. Bootstrapped and ran Go
testsuite on x86_64-unknown-linux-gnu. Committed to mainline.
Ian
[-- Attachment #2: foo.txt --]
[-- Type: text/plain, Size: 568 bytes --]
diff -r 28f37e5c57fe libgo/runtime/go-map-delete.c
--- a/libgo/runtime/go-map-delete.c Fri Dec 12 17:40:24 2014 -0800
+++ b/libgo/runtime/go-map-delete.c Fri Dec 12 17:55:34 2014 -0800
@@ -35,7 +35,10 @@
key_descriptor = descriptor->__map_descriptor->__key_type;
key_offset = descriptor->__key_offset;
key_size = key_descriptor->__size;
- __go_assert (key_size != 0 && key_size != -1UL);
+ if (key_size == 0)
+ return;
+
+ __go_assert (key_size != -1UL);
equalfn = key_descriptor->__equalfn;
key_hash = key_descriptor->__hashfn (key, key_size);
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2014-12-13 1:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-13 1:58 libgo patch committed: Permit delete from map with zero length key Ian Lance Taylor
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).