Summary

incorrect compilation of known local calls

Metadata

Description

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.

Changes and comments

[2024-09-17 13:10:58 UTC] felix changed status from new to closed

[2024-09-17 13:10:58 UTC] felix set resolution to fixed

[2024-09-17 13:10:58 UTC] felix wrote:

Fixed in 5e3d5620e2481bac26f21239962a709d68beea77 for C6.