Opened 5 months ago
Closed 3 months ago
#1839 closed defect (fixed)
incorrect compilation of known local calls
Reported by: | felix winkelmann | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | someday |
Component: | compiler | Version: | 6.0.0 |
Keywords: | optimizer | Cc: | |
Estimated difficulty: | medium |
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.
Fixed in 5e3d5620e2481bac26f21239962a709d68beea77 for C6.