[erlang-patches] Fix a bug in some binary comprehensions
Sun Mar 24 18:50:51 CET 2013
Peer noticed a crash when compiling some binary comprehensions, I tracked it
and it is related to the optimization done to use the bs_init_writable primop,
more specifically the generated code used to compute the size given to it
could sometimes use a variable which is bind by a generator, later in
a different scope.
An example of such binary comprehension is `<< <<0:S>> || S <- Slist >>`.
Such bogus Core Erlang code would be detected by core_lint, but unfortunately
the linting pass enabled through the +clint option is executed after the
destructive setelement/3 optimization, which is the pass that crash in presence
of an unbound variable.
My branch fixes the initial bug and introduces a new compile option +clint0,
which does the same as +clint but just before the dsetel optimization pass.
git fetch https://github.com/nox/otp.git fix-bc-optim
More information about the erlang-patches