From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Zefram Newsgroups: gmane.lisp.guile.bugs Subject: bug#21901: bit shift wrong on maximal right shift Date: Fri, 13 Nov 2015 10:22:03 +0000 Message-ID: <20151113102203.GL13455@fysh.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1447410237 26459 80.91.229.3 (13 Nov 2015 10:23:57 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 13 Nov 2015 10:23:57 +0000 (UTC) To: 21901@debbugs.gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Fri Nov 13 11:23:42 2015 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1ZxBVb-0005Q7-VA for guile-bugs@m.gmane.org; Fri, 13 Nov 2015 11:23:08 +0100 Original-Received: from localhost ([::1]:52075 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZxBVb-0003pt-Lt for guile-bugs@m.gmane.org; Fri, 13 Nov 2015 05:23:07 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33249) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZxBVX-0003or-P2 for bug-guile@gnu.org; Fri, 13 Nov 2015 05:23:04 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZxBVX-0004xI-23 for bug-guile@gnu.org; Fri, 13 Nov 2015 05:23:03 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:46955) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZxBVW-0004xE-V2 for bug-guile@gnu.org; Fri, 13 Nov 2015 05:23:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.80) (envelope-from ) id 1ZxBVW-0003Z9-Lp for bug-guile@gnu.org; Fri, 13 Nov 2015 05:23:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Zefram Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Fri, 13 Nov 2015 10:23:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 21901 X-GNU-PR-Package: guile X-GNU-PR-Keywords: X-Debbugs-Original-To: bug-guile@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.144741015113661 (code B ref -1); Fri, 13 Nov 2015 10:23:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 13 Nov 2015 10:22:31 +0000 Original-Received: from localhost ([127.0.0.1]:36663 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZxBV1-0003YH-6a for submit@debbugs.gnu.org; Fri, 13 Nov 2015 05:22:31 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:51355) by debbugs.gnu.org with esmtp (Exim 4.80) (envelope-from ) id 1ZxBUg-0003Xq-36 for submit@debbugs.gnu.org; Fri, 13 Nov 2015 05:22:28 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZxBUf-0004s5-5t for submit@debbugs.gnu.org; Fri, 13 Nov 2015 05:22:09 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:39446) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZxBUf-0004s1-32 for submit@debbugs.gnu.org; Fri, 13 Nov 2015 05:22:09 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33124) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZxBUe-00033R-4I for bug-guile@gnu.org; Fri, 13 Nov 2015 05:22:08 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZxBUd-0004re-CD for bug-guile@gnu.org; Fri, 13 Nov 2015 05:22:08 -0500 Original-Received: from river6.fysh.org ([2001:41d0:d:20da::2]:33089 helo=river.fysh.org) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZxBUd-0004rM-6D for bug-guile@gnu.org; Fri, 13 Nov 2015 05:22:07 -0500 Original-Received: from zefram by river.fysh.org with local (Exim 4.80 #2 (Debian)) id 1ZxBUZ-0001H9-I5; Fri, 13 Nov 2015 10:22:03 +0000 Content-Disposition: inline X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.15 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 208.118.235.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:7896 Archived-At: With Guile 2.0.11: scheme@(guile-user)> (ash 123 (ash -1 63)) $1 = 123 Correct result would of course be zero. Problem only occurs for exactly this shift distance: one bit less produces the right answer. Problem also occurs on Guile 1.8.8. Looking at the implementation, the problem is attributable to the negation of the shift distance, which in twos-complement fails to produce the expected positive result. Note the resemblance to bug #14864, fixed in 2.0.10. This bug is of very similar form, but is distinct. The test cases of #14864 pass for me on the 2.0.11 that shows the problem with a 2^63 bit shift. My bug does occur with the rnrs bitwise-arithmetic-shift-right, which was used in #14864, as well as with ash. -zefram