unknown_catch_try_state under R10B-2

Raimo Niskanen raimo@REDACTED
Sun Jan 2 20:01:12 CET 2005

It seems to be a bug in the beam_validator module (compiler
internal). It is a new post-processing pass that checks the
generated code to see if the compiler messed up some 
optimization and produced unsafe code. It has been tested
on most code we had available, but obviously not all code
in the world.

We will have a look at this problem after the christmas
vacations. Thank you for reducing the bug for us. To find
exactly what went wrong you will have to compile with the
-S switch to get a .beam assembly listing, then read and
understand it.

If you have to get forward sooner you can probably work around
the bug with a slight rewrite of the code. The validator seems
to have problems with a catch statement. It might be the  
parenthesis around "catch begin ... end", or the "begin ... end"
in a catch. That is the only thing that looks a bit odd. OK,
the "case ok of _ -> ... end" also looks a bit odd so it might
be the catch in such a statement...

Nevertheless we will locate this bug sooner or later.

bjorn@REDACTED (Björn Bylander) writes:

> I've reduced the incorrect code to this:
> -module(foomod).
> -export([handle_info/2]).
> -record(state, { foo = undefined }).
> handle_info({_}, State) ->
>    foo(),
>    State#state{foo = bar},
>    case ok of
>    _ ->
>      case catch foo() of
>      ok ->
>        {stop, State}
>      end
>    end;
> handle_info(_, State) ->
>    (catch begin
>      foo(),
>      State#state{foo = bar}
>    end),
>    case ok of
>    _ ->
>      case catch foo() of
>      ok ->
>        {stop, State}
>      end
>    end.
> foo() -> ok.
> On 2004-12-27 21:48, Björn Bylander wrote:
> > I get the following output from make:all([load]) with R10B-2 under
> > Windows. The module (admctrl_srv.erl) compiles fine under R9C-2,
> > R9C-1
> > and R9C-0. I haven't tried other R10 releases.
> > Recompile: admctrl_srv
> > admctrl_srv: function handle_info/2+2032:
> >   Internal consistency check failed - please report this bug.
> >   Instruction: {'%live',1}
> >   Error:       unknown_catch_try_state:
> > ./Admctrl_srv.erl:103: Warning: variable 'From' is unused
> > Apart from the obvious bug I find the first warning message odd in
> > that the 'a' in the module file name is an upper case 'a' and not a
> > lower case 'a' as it actually is and also is written in the warnings
> > following it...
> > Is there any info in the error message about the row on which this
> > occurs or do I have to try locate the row some other way?
> > /Björn Bylander


/ Raimo Niskanen, Erlang/OTP, Ericsson AB

More information about the erlang-questions mailing list