From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Andy Wingo Newsgroups: gmane.lisp.guile.bugs Subject: bug#21901: bit shift wrong on maximal right shift Date: Mon, 20 Jun 2016 18:02:50 +0200 Message-ID: <87porbg85x.fsf@pobox.com> References: <20151113102203.GL13455@fysh.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1466439410 32557 80.91.229.3 (20 Jun 2016 16:16:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 20 Jun 2016 16:16:50 +0000 (UTC) Cc: 21901@debbugs.gnu.org To: Zefram Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Mon Jun 20 18:16:34 2016 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 1bF1sI-0005ck-F4 for guile-bugs@m.gmane.org; Mon, 20 Jun 2016 18:16:34 +0200 Original-Received: from localhost ([::1]:44756 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bF1sH-0007DJ-MD for guile-bugs@m.gmane.org; Mon, 20 Jun 2016 12:16:33 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53952) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bF1fI-00087b-Rg for bug-guile@gnu.org; Mon, 20 Jun 2016 12:03:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bF1fC-00075y-7o for bug-guile@gnu.org; Mon, 20 Jun 2016 12:03:07 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:35574) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bF1fC-00075u-4h for bug-guile@gnu.org; Mon, 20 Jun 2016 12:03:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1bF1fB-00036U-Rq for bug-guile@gnu.org; Mon, 20 Jun 2016 12:03:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Andy Wingo Original-Sender: "Debbugs-submit" Resent-CC: bug-guile@gnu.org Resent-Date: Mon, 20 Jun 2016 16:03:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 21901 X-GNU-PR-Package: guile X-GNU-PR-Keywords: Original-Received: via spool by 21901-submit@debbugs.gnu.org id=B21901.146643858111923 (code B ref 21901); Mon, 20 Jun 2016 16:03:01 +0000 Original-Received: (at 21901) by debbugs.gnu.org; 20 Jun 2016 16:03:01 +0000 Original-Received: from localhost ([127.0.0.1]:47911 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bF1fA-00036F-SY for submit@debbugs.gnu.org; Mon, 20 Jun 2016 12:03:01 -0400 Original-Received: from pb-sasl1.pobox.com ([64.147.108.66]:56768 helo=sasl.smtp.pobox.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bF1f9-000368-J2 for 21901@debbugs.gnu.org; Mon, 20 Jun 2016 12:02:59 -0400 Original-Received: from sasl.smtp.pobox.com (unknown [127.0.0.1]) by pb-sasl1.pobox.com (Postfix) with ESMTP id 43F0A233B7; Mon, 20 Jun 2016 12:02:58 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; s=sasl; bh=Cwny4lShYwDtbeEnNwtGpVdpp88=; b=DQNLQU lJg9DdYa2Hruz4ES2WBtG16uM254ZGDDdJywZOuILSCtAIHR/+bNHJYxGZAVnHUK wPKOaE2+PHDGN9eg2SUR+jkAk19DB4BZRbBVxWFJKPIDhGinUmfqivByYKA8Umu1 3ypHu5msRd9ej/5CowqIGh/bXQ2CDHFxT+iIo= DomainKey-Signature: a=rsa-sha1; c=nofws; d=pobox.com; h=from:to:cc :subject:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=sasl; b=P3j3lAsR6Jc0vrb8STu+GMpuIGsFec50 +FfV3/3bENSICqL9mGOgYUBGDJsKUA2zDYxryfwBnHItG0Xgz4HR5+hOuEh62nEM FgUpPjBEzfORT5FaHLqS7sMDj6G0BIx9Ci4WlMiOL9kcOTHhQLXLe35R5IQDIh4/ HnmlubCmgiE= Original-Received: from pb-sasl1.nyi.icgroup.com (unknown [127.0.0.1]) by pb-sasl1.pobox.com (Postfix) with ESMTP id 3D001233B6; Mon, 20 Jun 2016 12:02:58 -0400 (EDT) Original-Received: from clucks (unknown [88.160.190.192]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by pb-sasl1.pobox.com (Postfix) with ESMTPSA id 8A17B233B4; Mon, 20 Jun 2016 12:02:57 -0400 (EDT) In-Reply-To: <20151113102203.GL13455@fysh.org> (zefram@fysh.org's message of "Fri, 13 Nov 2015 10:22:03 +0000") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux) X-Pobox-Relay-ID: 7498A1F0-3700-11E6-9E44-C1836462E9F6-02397024!pb-sasl1.pobox.com X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] 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" Xref: news.gmane.org gmane.lisp.guile.bugs:8026 Archived-At: On Fri 13 Nov 2015 11:22, Zefram writes: > 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. Fascinating, thank you! Also occurs on 2.1.3. Andy