unofficial mirror of guile-devel@gnu.org 
 help / color / mirror / Atom feed
* Bug int rtl.scm in wip-rtl
@ 2012-11-24 15:09 Stefan Israelsson Tampe
  0 siblings, 0 replies; only message in thread
From: Stefan Israelsson Tampe @ 2012-11-24 15:09 UTC (permalink / raw)
  To: guile-devel, Noah Lavine, Andy Wingo

[-- Attachment #1: Type: text/plain, Size: 1148 bytes --]

Hi, I just found a bug in rtl.scm, it's triggere by compiling larger rtl
codes.

In rtl.scm, we have the function

(define (link-text-object asm)
  (let ((buf (make-u32vector (asm-pos asm))))
    (let lp ((pos 0) (prev (reverse (asm-prev asm))))
      (if (null? prev)
          (let ((byte-size (* (asm-idx asm) 4)))
            (bytevector-copy! (asm-cur asm) 0 buf pos byte-size)
            (unless (eq? (asm-endianness asm) (native-endianness))
              (swap-bytes! buf))
            (make-object asm '.rtl-text
                         buf
                         (process-relocs buf (asm-relocs asm)
                                         (asm-labels asm))
                         (process-labels (asm-labels asm))))
          (let ((len (* *block-size* 4)))
            (bytevector-copy! (car prev) 0 buf pos len)
            (lp (+ pos len) (cdr prev)))))))

In thh lp loop I had added reverse in order for the code to emmit the
chunks in the right order (the bug was no reverse and we got code emitted
in the wrong order) as you can see for smaller codees prev is null and this
bug is not triggered.

Have fun with rtl,
/Stefan

[-- Attachment #2: Type: text/html, Size: 1241 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2012-11-24 15:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-11-24 15:09 Bug int rtl.scm in wip-rtl Stefan Israelsson Tampe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).