From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#69749: (bindat-type sint 32 t) -> unbound variable bitlen Date: Wed, 13 Mar 2024 13:53:12 +0200 Message-ID: <86cyrytkk7.fsf@gnu.org> References: <82a56165-7684-4f10-a6c4-60ff27de0417@risk-engineering.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29953"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 69749@debbugs.gnu.org To: Eric Marsden , Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Mar 13 12:53:55 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rkNBD-0007aA-MK for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 13 Mar 2024 12:53:55 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rkNAz-0000zj-5x; Wed, 13 Mar 2024 07:53:41 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rkNAl-0000oc-KJ for bug-gnu-emacs@gnu.org; Wed, 13 Mar 2024 07:53:27 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rkNAl-0004KB-Bt for bug-gnu-emacs@gnu.org; Wed, 13 Mar 2024 07:53:27 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rkNBK-00013H-Bt for bug-gnu-emacs@gnu.org; Wed, 13 Mar 2024 07:54:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 13 Mar 2024 11:54:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69749 X-GNU-PR-Package: emacs Original-Received: via spool by 69749-submit@debbugs.gnu.org id=B69749.17103308404028 (code B ref 69749); Wed, 13 Mar 2024 11:54:02 +0000 Original-Received: (at 69749) by debbugs.gnu.org; 13 Mar 2024 11:54:00 +0000 Original-Received: from localhost ([127.0.0.1]:44872 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rkNBI-00012t-73 for submit@debbugs.gnu.org; Wed, 13 Mar 2024 07:54:00 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:55760) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rkNBF-00012e-SU for 69749@debbugs.gnu.org; Wed, 13 Mar 2024 07:53:58 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rkNAa-0004IZ-G8; Wed, 13 Mar 2024 07:53:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=/i6w529O/ftsFafMEKOnKocTWFUv0EepphIQPur6GzY=; b=CgMWxJPgo2Utq4C3MR5v UWYuY8YhTiUFFp68NjbLMHwz0J4YqbvfyNjhhU5EWACKutGlfw4m0zh/RFrlnQL42tkdVBMeFnMp7 YRAPh70Dq8q1TFgDyW8It4rUUOt0ogya5vJZzZ6/2GZJu4qfLZnm8zT117TkkF/bpOBfyf32QEvo6 Lm9A6Tio/4GpnNS6pzkr1DewQ6FRofnlEPZa3wE5UE6aYY44O4ZEuY9b9SMrUpPhToyr1CSJK1Fp8 VdhE4FZjdxMmTit2le8HBx4E1MCAGz6CpTFTgTo1+dIfcJgQ8OUfgto4CwMgxIjHzV2CrbPAL5Px/ j0EvPFY3Z0CPCg==; In-Reply-To: <82a56165-7684-4f10-a6c4-60ff27de0417@risk-engineering.org> (message from Eric Marsden on Tue, 12 Mar 2024 16:18:58 +0100) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:281546 Archived-At: > Date: Tue, 12 Mar 2024 16:18:58 +0100 > From: Eric Marsden > > -- file bd.el > (require 'bindat) > (bindat-pack (bindat-type sint 32 t) 42) > -- > emacs -Q --batch -l bd.el --> > > Error: void-variable (bitlen) >   mapbacktrace(#f(compiled-function (evald func args flags) # -0x160fbb9816517825>)) >   debug-early-backtrace() >   debug-early(error (void-variable bitlen)) >   (/ bitlen 8) >   (+ bindat-idx (/ bitlen 8)) >   (setq bindat-idx (+ bindat-idx (/ bitlen 8))) >   (let ((v field2)) (setq bindat-idx (+ bindat-idx (/ bitlen 8)))) >   (let ((field2 (if (< v 0) (+ v wrap) v))) (let ((v field2)) (setq > bindat-idx (+ bindat-idx (/ bitlen 8))))) >   (let ((v v)) (let ((field2 (if (< v 0) (+ v wrap) v))) (let ((v > field2)) (setq bindat-idx (+ bindat-idx (/ bitlen 8)))))) >   (lambda (v) (let ((v v)) (let ((field2 (if (< v 0) (+ v wrap) v))) > (let ((v field2)) (setq bindat-idx (+ bindat-idx (/ bitlen 8)))))))(42) >   bindat--length-group(42 #s(bindat--type :le (lambda (v) (let ((v v)) > (let ((field2 (if (< v 0) (+ v wrap) v))) (let ((v field2)) (setq > bindat-idx (+ bindat-idx (/ bitlen 8))))))) :ue (lambda nil (let ((n (if > t (bindat--unpack-uintr bitlen) (bindat--unpack-uint bitlen)))) (if (>= > n max) (- n wrap) n))) :pe (lambda (v) (let ((v v)) (let ((field2 (if (< > v 0) (+ v wrap) v))) (let ((v field2)) (if t (bindat--pack-uintr bitlen > v) (bindat--pack-uint bitlen v)))))))) >   bindat-length(#s(bindat--type :le (lambda (v) (let ((v v)) (let > ((field2 (if (< v 0) (+ v wrap) v))) (let ((v field2)) (setq bindat-idx > (+ bindat-idx (/ bitlen 8))))))) :ue (lambda nil (let ((n (if t > (bindat--unpack-uintr bitlen) (bindat--unpack-uint bitlen)))) (if (>= n > max) (- n wrap) n))) :pe (lambda (v) (let ((v v)) (let ((field2 (if (< v > 0) (+ v wrap) v))) (let ((v field2)) (if t (bindat--pack-uintr bitlen v) > (bindat--pack-uint bitlen v))))))) 42) >   bindat-pack(#s(bindat--type :le (lambda (v) (let ((v v)) (let > ((field2 (if (< v 0) (+ v wrap) v))) (let ((v field2)) (setq bindat-idx > (+ bindat-idx (/ bitlen 8))))))) :ue (lambda nil (let ((n (if t > (bindat--unpack-uintr bitlen) (bindat--unpack-uint bitlen)))) (if (>= n > max) (- n wrap) n))) :pe (lambda (v) (let ((v v)) (let ((field2 (if (< v > 0) (+ v wrap) v))) (let ((v field2)) (if t (bindat--pack-uintr bitlen v) > (bindat--pack-uint bitlen v))))))) 42) >   load-with-code-conversion("/tmp/bd.el" "/tmp/bd.el" nil t) >   command-line-1(("-l" "/tmp/bd.el")) >   command-line() >   normal-top-level() > Symbol’s value as variable is void: bitlen > > This bug is difficult to understand. Run from an IELM buffer, this code > works as expected. The macroexpansion of the bindat-type declaration > includes a binding for bitlen. Thanks, I added Stefan to this discussion.