Mark H Weaver <m...@netris.org> writes:

> Mark H Weaver <m...@netris.org> writes:
>
>> I believe the problem is most likely in 'lift-applied-lambda' in
>> peval.scm.  When transforming:
>>
>>   (lambda args (apply (lambda ...) args)) => (lambda ...)
>>
>> it does not appear to check whether 'args' is referenced within the
>> inner lambda.

It occurs to me that there's another problem with this optimization:

  scheme@(guile-user)> ,optimize (lambda (x y . z) (apply (lambda x x) x y z))
  $1 = (lambda x x)

This optimization changes the arity of the procedure.  The original
version checks that at least 2 arguments are provided, and ensures that
at least 2 arguments are passed to the inner procedure, which the code
might depend on.  The optimization effectively removes this check.

I'll look into how to fix this.

       Mark



Reply via email to