diff options
| author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-12-12 23:29:10 +0000 |
|---|---|---|
| committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2012-12-12 23:29:10 +0000 |
| commit | fc886417c79fcfe4a0176f81a52686eff3eb3733 (patch) | |
| tree | a3ebb151582706d18204c86ddf5b9e4fe73ed6c5 | |
| parent | d66d56be792aed2fba99d9d28611bac79738db92 (diff) | |
| download | ppe42-gcc-fc886417c79fcfe4a0176f81a52686eff3eb3733.tar.gz ppe42-gcc-fc886417c79fcfe4a0176f81a52686eff3eb3733.zip | |
runtime: Delete from a nil map is now a no-op.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@194462 138bc75d-0d04-0410-961f-82ee72b054a4
| -rw-r--r-- | gcc/testsuite/go.test/test/nil.go | 5 | ||||
| -rw-r--r-- | libgo/runtime/go-map-delete.c | 2 |
2 files changed, 3 insertions, 4 deletions
diff --git a/gcc/testsuite/go.test/test/nil.go b/gcc/testsuite/go.test/test/nil.go index 9f7bcbb59fd..aa558fa3f49 100644 --- a/gcc/testsuite/go.test/test/nil.go +++ b/gcc/testsuite/go.test/test/nil.go @@ -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 diff --git a/libgo/runtime/go-map-delete.c b/libgo/runtime/go-map-delete.c index b25760fc820..f8f8907c345 100644 --- a/libgo/runtime/go-map-delete.c +++ b/libgo/runtime/go-map-delete.c @@ -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; |

