]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
runtime: Delete from a nil map is now a no-op.
authorIan Lance Taylor <ian@gcc.gnu.org>
Wed, 12 Dec 2012 23:29:10 +0000 (23:29 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Wed, 12 Dec 2012 23:29:10 +0000 (23:29 +0000)
From-SVN: r194462

gcc/testsuite/go.test/test/nil.go
libgo/runtime/go-map-delete.c

index 9f7bcbb59fdb6182b2528f82bfd0019382eb62d0..aa558fa3f49c57da8610fe51449d0d16ba5343b9 100644 (file)
@@ -151,9 +151,8 @@ func maptest() {
        shouldPanic(func() {
                m[2] = 3
        })
-       shouldPanic(func() {
-               delete(m, 2)
-       })
+       // can delete (non-existent) entries
+       delete(m, 2)
 }
 
 // nil slice
index b25760fc8204b601f1207ab828b38a4c3aeaef85..f8f8907c345b020931bd0a7efe8bf5ba12950929 100644 (file)
@@ -27,7 +27,7 @@ __go_map_delete (struct __go_map *map, const void *key)
   void **pentry;
 
   if (map == NULL)
-    runtime_panicstring ("deletion of entry in nil map");
+    return;
 
   descriptor = map->__descriptor;