Mettle

body-localA local is declared inside the loop body

Reported by --explain after a verdict.

mettle explain body-local

The recognizers match on a straight run of loads, arithmetic and stores. A local declared in the body adds a stack slot written every iteration, which none of the shapes cover.

Fix: declare the variable before the loop and assign it inside, or fold the expression into the statement that uses it.

Related