GNU bug report logs - #29132
[PATCH] system: vm: Use 2^32 - 1 as hash size.

Previous Next

Package: guix-patches;

Reported by: Mathieu Othacehe <m.othacehe <at> gmail.com>

Date: Fri, 3 Nov 2017 12:50:01 UTC

Severity: normal

Tags: fixed, patch

Done: Mathieu Othacehe <m.othacehe <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #11 received at 29132 <at> debbugs.gnu.org (full text, mbox):

From: Mathieu Othacehe <m.othacehe <at> gmail.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 29132 <at> debbugs.gnu.org
Subject: Re: [bug#29132] [PATCH] system: vm: Use 2^32 - 1 as hash size.
Date: Sun, 05 Nov 2017 21:56:13 +0100
Hey Ludo,

> So I take it that you always get something in the range 0–2³²-1, no?

Well I agree, but looking to hash code, we have :

--8<---------------cut here---------------start------------->8---
#define FUNC_NAME s_scm_hash
{
  unsigned long sz = scm_to_unsigned_integer (size, 1, ULONG_MAX);
--8<---------------cut here---------------end--------------->8---

And 2^32 > ULONG_MAX == 2^32 - 1 on ARM.

This results in this exception :

--8<---------------cut here---------------start------------->8---
scheme@(guile-user)> (hash 'test (expt 2 32))
ERROR: In procedure hash:
ERROR: Value out of range 1 to 4294967295: 4294967296
--8<---------------cut here---------------end--------------->8---

Mathieu




This bug report was last modified 7 years and 261 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.