summaryrefslogtreecommitdiff
path: root/libgo/runtime/go-new-map.c
diff options
context:
space:
mode:
Diffstat (limited to 'libgo/runtime/go-new-map.c')
-rw-r--r--libgo/runtime/go-new-map.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libgo/runtime/go-new-map.c b/libgo/runtime/go-new-map.c
index 3a471299b22..05ac8a1a40c 100644
--- a/libgo/runtime/go-new-map.c
+++ b/libgo/runtime/go-new-map.c
@@ -106,9 +106,11 @@ __go_map_next_prime (uintptr_t n)
struct __go_map *
__go_new_map (const struct __go_map_descriptor *descriptor, uintptr_t entries)
{
+ int ientries;
struct __go_map *ret;
- if ((uintptr_t) (int) entries != entries)
+ ientries = (int) entries;
+ if (ientries < 0 || (uintptr_t) ientries != entries)
__go_panic_msg ("map size out of range");
if (entries == 0)