GNU bug report logs - #14916
Fixnum procedures can be made to return non-fixnums

Previous Next

Package: guile;

Reported by: Göran Weinholt <goran <at> weinholt.se>

Date: Sat, 20 Jul 2013 06:00:03 UTC

Severity: normal

Full log


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

From: Göran Weinholt <goran <at> weinholt.se>
To: bug-guile <at> gnu.org
Subject: Fixnum procedures can be made to return non-fixnums
Date: Sat, 20 Jul 2013 07:56:21 +0200
[Message part 1 (text/plain, inline)]
Hello schemers,

the fxdiv procedure from (rnrs) fails to check that its result is
representable as a fixnum:

scheme@(guile-user)> (import (rnrs))
scheme@(guile-user)> (fxdiv (least-fixnum) -1)
$1 = 2305843009213693952

It should raise an &implementation-restriction. Here are a few other
examples of the same problem:

scheme@(guile-user)> (fxdiv-and-mod (least-fixnum) -1)
$2 = 2305843009213693952
$3 = 0
scheme@(guile-user)> (fxdiv0 (least-fixnum) -1)
$4 = 2305843009213693952
scheme@(guile-user)> (fxdiv0-and-mod0 (least-fixnum) -1)
$5 = 2305843009213693952
$6 = 0
scheme@(guile-user)> (fxarithmetic-shift-left (greatest-fixnum) 1)
$7 = 4611686018427387902
scheme@(guile-user)> (fxarithmetic-shift (greatest-fixnum) 1)
$8 = 4611686018427387902

Tested with Guile 2.0.9.40-824b-dirty on an amd64 system.

Regards,

-- 
Göran Weinholt <goran <at> weinholt.se>
"Detta skall jag visa dig medelst ett stort papper som jag har fyllt
med faktiska upplysningar!" -- August Strindberg
[Message part 2 (application/pgp-signature, inline)]

This bug report was last modified 8 years and 358 days ago.

Previous Next


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