[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Bug int rtl.scm in wip-rtl

From: Stefan Israelsson Tampe
Subject: Bug int rtl.scm in wip-rtl
Date: Sat, 24 Nov 2012 16:09:18 +0100

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
                         (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,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]