GNU bug report logs - #32644
bytevector bug

Previous Next

Package: guile;

Reported by: Stefan Israelsson Tampe <stefan.itampe <at> gmail.com>

Date: Wed, 5 Sep 2018 17:54:02 UTC

Severity: normal

Done: Mark H Weaver <mhw <at> netris.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 32644 in the body.
You can then email your comments to 32644 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guile <at> gnu.org:
bug#32644; Package guile. (Wed, 05 Sep 2018 17:54:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Israelsson Tampe <stefan.itampe <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Wed, 05 Sep 2018 17:54:02 GMT) Full text and rfc822 format available.

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

From: Stefan Israelsson Tampe <stefan.itampe <at> gmail.com>
To: bug-guile <at> gnu.org
Subject: bytevector bug
Date: Wed, 5 Sep 2018 19:53:02 +0200
[Message part 1 (text/plain, inline)]
Hi,

The code velow does not compile when the define-inlinable of id is active.
If in stead
id defined by define is used it all compiles just fine.

Tested on latest tar ball for guile 2.4
-------------------------------------------
(use-modules (rnrs bytevectors))

(define-inlinable (id x) x)
;(define (id x) x)
(define-syntax-rule (mkcrc crc_hqx high xor mask)
  (define (crc_hqx data value)
       (let ((n (bytevector-length data))
     (d data))
(let lp ((i 0) (v value))
   (if (< i n)
       (let ((b (id (bytevector-u8-ref d i))))
(let lp2 ((j 0) (x 1) (v v))
   (if (> j -8)
       (let ((bit   (ash (logand x b) j))
     (hbit  (logand v high)))
(if (= hbit 0)
     (lp2 (- j 1) (ash x 1) (logior bit (ash v 1)))
     (lp2 (- j 1) (ash x 1) (logxor
     xor
     (logand mask
     (logior
      bit
      (ash v 1)))))))
       (lp (+ i 1) v))))
       v)))))

(mkcrc crc_hqx #x8000     #x1021     #xffff)
(mkcrc crc32   #x80000000 #x04c11db7 #xffffffff)
[Message part 2 (text/html, inline)]

Information forwarded to bug-guile <at> gnu.org:
bug#32644; Package guile. (Thu, 06 Sep 2018 17:29:02 GMT) Full text and rfc822 format available.

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

From: Mark H Weaver <mhw <at> netris.org>
To: Stefan Israelsson Tampe <stefan.itampe <at> gmail.com>
Cc: 32644 <at> debbugs.gnu.org
Subject: Re: bug#32644: bytevector bug
Date: Thu, 06 Sep 2018 13:27:11 -0400
Stefan Israelsson Tampe <stefan.itampe <at> gmail.com> writes:

> The code velow does not compile when the define-inlinable of id is active. If in stead
> id defined by define is used it all compiles just fine.
>
> Tested on latest tar ball for guile 2.4

Did you mean to write guile 2.2.4?

      Mark


> -------------------------------------------
> (use-modules (rnrs bytevectors))
>
> (define-inlinable (id x) x)
> ;(define (id x) x)
> (define-syntax-rule (mkcrc crc_hqx high xor mask)
>   (define (crc_hqx data value)
>        (let ((n (bytevector-length data))
>      (d data))
> (let lp ((i 0) (v value))
>    (if (< i n)
>        (let ((b (id (bytevector-u8-ref d i))))
> (let lp2 ((j 0) (x 1) (v v))
>    (if (> j -8)
>        (let ((bit   (ash (logand x b) j))
>      (hbit  (logand v high)))
> (if (= hbit 0)
>      (lp2 (- j 1) (ash x 1) (logior bit (ash v 1)))
>      (lp2 (- j 1) (ash x 1) (logxor
>      xor
>      (logand mask
>      (logior
>       bit
>       (ash v 1)))))))
>        (lp (+ i 1) v))))
>        v)))))
>
> (mkcrc crc_hqx #x8000     #x1021     #xffff)
> (mkcrc crc32   #x80000000 #x04c11db7 #xffffffff)




Information forwarded to bug-guile <at> gnu.org:
bug#32644; Package guile. (Fri, 14 Sep 2018 18:45:01 GMT) Full text and rfc822 format available.

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

From: Stefan Israelsson Tampe <stefan.itampe <at> gmail.com>
To: Mark H Weaver <mhw <at> netris.org>
Cc: 32644 <at> debbugs.gnu.org
Subject: Re: bug#32644: bytevector bug
Date: Fri, 14 Sep 2018 20:44:35 +0200
[Message part 1 (text/plain, inline)]
I managed to get it to compile on the latest lightning branch as of
2018-09-14

On Thu, Sep 6, 2018 at 7:28 PM Mark H Weaver <mhw <at> netris.org> wrote:

> Stefan Israelsson Tampe <stefan.itampe <at> gmail.com> writes:
>
> > The code velow does not compile when the define-inlinable of id is
> active. If in stead
> > id defined by define is used it all compiles just fine.
> >
> > Tested on latest tar ball for guile 2.4
>
> Did you mean to write guile 2.2.4?
>
>       Mark
>
>
> > -------------------------------------------
> > (use-modules (rnrs bytevectors))
> >
> > (define-inlinable (id x) x)
> > ;(define (id x) x)
> > (define-syntax-rule (mkcrc crc_hqx high xor mask)
> >   (define (crc_hqx data value)
> >        (let ((n (bytevector-length data))
> >      (d data))
> > (let lp ((i 0) (v value))
> >    (if (< i n)
> >        (let ((b (id (bytevector-u8-ref d i))))
> > (let lp2 ((j 0) (x 1) (v v))
> >    (if (> j -8)
> >        (let ((bit   (ash (logand x b) j))
> >      (hbit  (logand v high)))
> > (if (= hbit 0)
> >      (lp2 (- j 1) (ash x 1) (logior bit (ash v 1)))
> >      (lp2 (- j 1) (ash x 1) (logxor
> >      xor
> >      (logand mask
> >      (logior
> >       bit
> >       (ash v 1)))))))
> >        (lp (+ i 1) v))))
> >        v)))))
> >
> > (mkcrc crc_hqx #x8000     #x1021     #xffff)
> > (mkcrc crc32   #x80000000 #x04c11db7 #xffffffff)
>
[Message part 2 (text/html, inline)]

Reply sent to Mark H Weaver <mhw <at> netris.org>:
You have taken responsibility. (Sun, 14 Oct 2018 07:39:02 GMT) Full text and rfc822 format available.

Notification sent to Stefan Israelsson Tampe <stefan.itampe <at> gmail.com>:
bug acknowledged by developer. (Sun, 14 Oct 2018 07:39:02 GMT) Full text and rfc822 format available.

Message #16 received at 32644-done <at> debbugs.gnu.org (full text, mbox):

From: Mark H Weaver <mhw <at> netris.org>
To: Stefan Israelsson Tampe <stefan.itampe <at> gmail.com>
Cc: 32644-done <at> debbugs.gnu.org
Subject: Re: bug#32644: bytevector bug
Date: Sun, 14 Oct 2018 03:38:11 -0400
Stefan Israelsson Tampe <stefan.itampe <at> gmail.com> writes:
> The code velow does not compile when the define-inlinable of id is active. If in stead
> id defined by define is used it all compiles just fine.

The problem was that, in some cases, the type inferrer would call 'ash'
with (- 1 (expt 2 64)) as the second argument during compilation.  The
implementation of 'ash' would raise an exception unless its second
argument (the shift count) fits in a C 'long'.

This is fixed in commit 011aec7e240ef987931548d90c53e6692c85d01c on the
stable-2.2 branch.  That commit extends 'ash' and 'round-ash' to
gracefully handle several cases where the shift count is too large to
fit in a 'long'.

Thanks for the report.

      Mark




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 11 Nov 2018 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 165 days ago.

Previous Next


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