Subject: bug#15533: optimizing away noticeable effects

From: Ian Price <[email-masked]>
Date: Mon, 07 Oct 2013 17:55:36 +0100

Mark H Weaver <[email-masked]> writes:

> Using git bisect, I've determined that this bug was introduced in the
> following commit:
>
> commit d21537efb4a0edea30a7ab801909207d4bb69030
> Author: Andy Wingo <[email-masked]>
> Date:   Fri Feb 15 12:11:29 2013 +0100
>
>     better inlining of `apply' with rest arguments
>     
>     * module/language/tree-il/peval.scm (peval): Move up the find-definition
>       helper.  Use it to speculatively destructure conses and lists into the
>       tail position of an `apply' form.
>     
>     * test-suite/tests/peval.test ("partial evaluation"): Add tests.

Thanks for bisecting mark, I've had a little look and this is the right
patch. The actual error occurs at the very beginning of the loop, in the
variable tail*.

Originally, this was a call (for-value tail), which returned a
lexical-ref. Now it is a call (find-definition tail) which returns a
const ().

We obviously need to have a check for mutability when referring to a
variable, the question is where?

Does it make sense to add it to find-definition? or should we add it
before the use in that case?

-- 
Ian Price -- shift-reset.com

"Programming is like pinball. The reward for doing it well is
the opportunity to do it again" - from "The Wizardy Compiled"