bugMIT/GNU Scheme - Bugs: bug #55090, 9.2 -> 10.1 breaks macro by...

 
 

bug #55090: 9.2 -> 10.1 breaks macro by skipping some variable renaming

Submitter:  Arthur A. Gleckler <aag>
Submitted:  Sat 24 Nov 2018 11:50:55 PM UTC
   
 
Category:  runtime Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect behavior
Status:  Fixed Privacy:  Public
Assigned to:  cph Originator Name: 
Open/Closed:  Closed
Keywords: 
* Mandatory Fields

Add a New Comment Rich Markup
   

Sat 08 Dec 2018 10:09:24 PM UTC, comment #2: 

I just pulled and built from scratch (maintainer-clean) to see whether the bug fix worked.  Unfortunately, I'm getting another new error in an equally old syntax-rules macro.  I'll try to put together a narrow, reproducible test as soon as I can.

Arthur A. Gleckler <aag>
Group Member
Sun 25 Nov 2018 06:45:32 AM UTC, comment #1: 

Interesting. I'm able to reproduce the behavior with an ordinary macro, but only if it's written using rsc-macro-transformer or er-macro-transformer. One written with sc-macro-transformer works fine.

Chris Hanson <cph>
Group administrator
Sat 24 Nov 2018 11:50:55 PM UTC, original submission:  

While porting my code to 10.1, I've found one macro that no longer works.  The problem is that one variable is no longer renamed upon a recursive macro call.  Since the same macro worked under 9.2 and with other syntax-rules implementations (e.g. it's part of the implementation of SRFI 146, which runs on other Schemes), I'm fairly confident that this is a bug.

For this bug report, I've pared the macro down to this:


(define-syntax vector-edit-code
  (syntax-rules ()
    ((_ v r o s)
     (let ((index (vector-length v)))
       (subvector-move-left! v o index r (+ o s))
       r))
    ((_ v r o s i e)
     (let ((index i))
       (subvector-move-left! v o index r (+ o s))
       (vector-set! r (+ s index) e)
       (let ((skew (1+ s)))
         (vector-edit-code v r index skew))))))


Here's an example:


(pp (lambda () (let ((input (vector 0 1 3))) (let ((array (make-vector 4))) (vector-edit-code input array 0 0 2 2)))))


In 9.2, evaluating that expression produces:


(lambda ()
  (let ((input (vector 0 1 3)))
    (let ((array (make-vector 4)))
      (let ((index 2))
        (subvector-move-left! input 0 index array (+ 0 0))
        (vector-set! array (+ 0 index) 2)
        (let ((skew (1+ 0)))
          (let ((.index.1-0 (vector-length input)))
            (subvector-move-left! input index .index.1-0 array (+ index skew))
            array))))))


In 10.1, evaluating the same form produces:


(lambda ()
  (let ((input (vector 0 1 3)))
    (let ((array (make-vector 4)))
      (let ((index 2))
        (subvector-move-left! input 0 index array (+ 0 0))
        (vector-set! array (+ 0 index) 2)
        (let ((skew (|1+| 0)))
          (let ((index (vector-length input)))
            (subvector-move-left! input index index array (+ index skew))
            array))))))


The inner use of the identifier index does not get renamed, which makes the calculation fail.

Arthur A. Gleckler <aag>
Group Member

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by cph (Posted a comment)
  • -email is unavailable- added by aag (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only logged-in users can vote.

     

    Follow 4 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-09-21 cph Open/ClosedOpen Closed
    2018-12-08 cph StatusIn Progress Fixed
    2018-11-25 cph StatusNone In Progress
        Assigned toNone cph

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code