Opened 4 years ago

Closed 4 years ago

#1758 closed defect (fixed)

Rest-argument optimization related internal compiler error

Reported by: Idiomdrottning Owned by:
Priority: major Milestone: 5.3
Component: compiler Version: 5.2.0
Keywords: optimizer Cc:
Estimated difficulty:

Description

mdg extension is in brev egg and also depends on match-generics egg

(import mdg (chicken base))


(define (pairup lis) lis)


(define (pairup (a b . rest))

(cons (list a b) (pairup rest)))


(print (pairup '(a b c d e f g h)))

;; on -O2, prints ((a b) (c d) (e f) (g h))
;; on -O3, Error: [internal compiler error] Unknown rest op node class in while converting to closure. This shouldn't happen!: ##core#rest-null?

Change History (8)

comment:1 Changed 4 years ago by megane

Somewhat reduced:

(set! pairup
    (lambda args
      (let ((ren args))
        (let ((fail
               (lambda ()
                 (if (pair? ren)
                     (null? (cdr ren))))))
          (if (pair? ren)
              1
              (fail))))))

comment:2 Changed 4 years ago by Idiomdrottning

That doesn't crash for me though.

comment:3 in reply to:  2 Changed 4 years ago by megane

Replying to Idiomdrottning:

That doesn't crash for me though.

Interesting. What options, csc version is that?

I'm using -O3 and Version 5.2.1 (rev ea32b1d0).

comment:4 Changed 4 years ago by megane

Component: unknowncompiler
Keywords: optimizer added
Milestone: someday5.3
Summary: internal compiler errorRest-argument optimization related internal compiler error

comment:5 Changed 4 years ago by Idiomdrottning

ellen% csc -version
csc -version
CHICKEN
(c) 2008-2020, The CHICKEN Team
(c) 2000-2007, Felix L. Winkelmann
Version 5.2.0 (rev 317468e4)
linux-unix-gnu-x86-64 [ 64bit dload ptables ]

comment:6 Changed 4 years ago by Idiomdrottning

-O3, no -d flags

comment:7 Changed 4 years ago by felix winkelmann

This was just a typo. Patch pending:

 core.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/core.scm b/core.scm
index 85ccc649..5ca76d1d 100644
--- a/core.scm
+++ b/core.scm
@@ -2668,7 +2668,7 @@
 		       (transform (make-node '##core#inline
 					     (list "C_i_list_ref")
 					     (list rest-var (qnode (second params)))) here closure))
-		      ((##core#rest-null)
+		      ((##core#rest-null?)
 		       (transform (make-node '##core#inline
 					     (list "C_i_greater_or_equal_p")

comment:8 Changed 4 years ago by felix winkelmann

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.