Solve the missed local dimension bug with strides and modulo guards
The problem came from an inconsistency between "for" and "if" when
creating a new local dimension: "for" incremented the loop depth
before creating a new local dimension while "if" incremented the
if depth after creating the new local dimension. Since after a
loop or if body, the number of local dimension at this depth was
zero'ed, the inconsistency could, e.g., make a "if" to remove some
"for" local dimensions.
This patch makes the ordering coherent: "for" now may create local
dimensions before incrementing the loop depths. This solution was
chosen because of the limited change to the code.