chicken-janitors
[Top][All Lists]
Advanced

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

#1839: incorrect compilation of known local calls


From: Chicken Trac
Subject: #1839: incorrect compilation of known local calls
Date: Fri, 19 Jul 2024 08:43:58 -0000

#1839: incorrect compilation of known local calls
-----------------------------------------+-----------------------
            Reporter:  felix winkelmann  |       Type:  defect
              Status:  new               |   Priority:  major
           Milestone:  someday           |  Component:  compiler
             Version:  6.0.0             |   Keywords:  optimizer
Estimated difficulty:  medium            |
-----------------------------------------+-----------------------
 Locally bound known procedures are marked during closure conversion as
 "customizable" when all call sites are known which allows passing
 arguments directly instead of using the argc/argvector convention. The
 compiler does this marking on the first encounter of a call to such a
 procedure with matches the signature. But if a later call does not match
 the lambda-list the mark is still active, even though that later call uses
 the standard convention and the callee will be compiled with a
 customizable arglist. This means that the later call uses the wrong
 calling convention resulting in a crash.

 Here an example:
 {{{
 (define (foo x)
   (define (bar x y)
     (let ((k (identity bar)))
       (k 1))
     (if (> x 1) (bar (sub1 x) y)))
   (bar 2 x))
 (foo '(a b))
 }}}

 This bug was detected in 6.0.0 but seems already to be present in earlier
 5.x.x releases.

 A remedy would be to drop the mark when not all call sites have arguments
 that match the lambda list of the callee.

-- 
Ticket URL: <https://bugs.call-cc.org/ticket/1839>
CHICKEN Scheme <https://www.call-cc.org/>
CHICKEN Scheme is a compiler for the Scheme programming language.

reply via email to

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