Erlang/OTP Forums

Author Message

<  Erlang bugs mailing list  ~  internal compiler faults

Guest
Posted: Thu Dec 10, 2009 12:12 pm Reply with quote
Guest
Hi,
I was trying to refine some code (that I can't publish) that threw
this error on compilation:

xxx: function make_content_list/6+108:
Internal consistency check failed - please report this bug.
Instruction: {move,{y,0},{x,0}}
Error: {unassigned,{y,0}}:

And instead I get something different with the attached module using
two variants of more or less the same code from the first error:

d124:test_server simon$ erlc -W ~/tmp/a1.erl
Function: bad/3
/Users/simon/tmp/a1.erl:none: internal error in beam_bool;
crash reason: {{case_clause,
{'EXIT',
{function_clause,
[{gb_trees,get_1,[{tmp,0},nil]},
{beam_bool,bopt_good_arg,2},
{beam_bool,bopt_good_args,2},
{beam_bool,bopt_tree,3},
{beam_bool,bopt_tree,3},
{beam_bool,bopt_tree_cg,3},
{beam_bool,bopt_block,5},
{beam_bool,bopt,3}]}}},
[{compile,'-select_passes/2-anonymous-2-',2},
{compile,'-internal_comp/4-anonymous-1-',2},
{compile,fold_comp,3},
{compile,internal_comp,4},
{compile,internal,3}]}

Build is http://github.com/erlang/otp/tree/ee51ffa886cdbc7a577d6e068236c107f0137696
(a few behind on ccase/r13b04_dev), host is OSX 10.6 (32-bit kernel)
built with --enable-darwin-64bit

Any hints on debugging/fixing the first error will also be appreciated.

/Simon


Post received from mailinglist
Guest
Posted: Thu Dec 10, 2009 1:12 pm Reply with quote
Guest
Simon Cornish wrote:
> Hi,
> I was trying to refine some code (that I can't publish) that threw
> this error on compilation:
>
> xxx: function make_content_list/6+108:
> Internal consistency check failed - please report this bug.
> Instruction: {move,{y,0},{x,0}}
> Error: {unassigned,{y,0}}:

This error might or might not be the same as the one the program you
attached in your previous mail is suffering from (function clause
exception in gb_trees:get/1) -- we'll never know if you do not show us
the code. Please try to minimize it so that it shows the same internal
consistency problem as above -- minimizing it not only saves time for
the compiler maintainer but it also makes sure that the program will be
useful to no one other than the compiler writers -- and send it here.

> And instead I get something different with the attached module using
> two variants of more or less the same code from the first error:

For Bjorn, I guess, I include a smaller version of your module that also
throws the same error as the program you attached.

Function: bad/3
/home/kostis/a1.erl:none: internal error in beam_bool;
crash reason: {{case_clause,
{'EXIT',
{function_clause,
[{gb_trees,get_1,[{tmp,0},nil]},
{lists,mapfoldl,3}]}}},

> Any hints on debugging/fixing the first error will also be appreciated.

You've not shown us the problematic code so it's very hard to know
what's happening, but here is some educated guess on how to bypass it:

Your program has the following construct:

Var = BOOLEAN_EXPR,
if Var == true;
Var == false,OTHER_TESTS -> ...

Change this to either:

Var = BOOLEAN_EXPR,
if Var == true orelse
Var == false,OTHER_TESTS -> ...

or to simply:

Var = BOOLEAN_EXPR,
if Var == true;
OTHER_TESTS -> ...

Kostis


Post received from mailinglist
Guest
Posted: Thu Dec 10, 2009 9:38 pm Reply with quote
Guest
On Thu, Dec 10, 2009 at 2:05 PM, Kostis Sagonas <kostis@cs.ntua.gr> wrote:

> For Bjorn, I guess, I include a smaller version of your module that also
> throws the same error as the program you attached.

Thanks for minimizing the example.

I have included a fix in the 'pu' branch. Basically, my fix just
treats the symptom (disabling the optimization for that kind of code
instead of crashing), but I have looked at the code to understand
why it crashed and added some information about it to the comments
and commit message.


To debug problems found by the beam_validator, I generally start
by disabling various optimization passes to see if the problem
disappears. If it does, I know in which part of the code to start
looking.

Type

compile:options()

in the shell to get a list of the compiler options (the one
with the explanation "Skip..." are the ones you are
interested in).

--
Björn Gustavsson, Erlang/OTP, Ericsson AB

________________________________________________________________
erlang-bugs mailing list. See http://www.erlang.org/faq.html
erlang-bugs (at) erlang.org

Post received from mailinglist
Guest
Posted: Fri Dec 11, 2009 2:21 pm Reply with quote
Guest
Hi Bj
Guest
Posted: Fri Dec 11, 2009 3:38 pm Reply with quote
Guest
On Fri, Dec 11, 2009 at 3:20 PM, Simon Cornish <zl9d97p02@sneakemail.com> wrote:

> I fail to see how this minimisation helps the discussion. The point of
> including both the yes/3 and bad/3 functions was to show that only one
> of the two different methods of calculating Do1 & Do2 caused the
> crash. I would have thought this would help point to the underlying
> optimisation error.

It helped me. I generally debug optimization problems
by printing out and inspecting the internal data structures,
so the smaller the better. Having different versions to
compare can be useful, however, when I have located
the problem and I need to decide the best way to solve it.

> Regarding the internal consistency check, I used the beam_bool patch
> and still encountered the same problem. Attached is a small example.
> It will compile if no_bopt is used. It will also compile if the
> boolean guard is not repeated (eg. CH2 is assigned a constant value).

Thanks! That information gives me a pretty good idea
where I should start looking for the problem.

--
Björn Gustavsson, Erlang/OTP, Ericsson AB

________________________________________________________________
erlang-bugs mailing list. See http://www.erlang.org/faq.html
erlang-bugs (at) erlang.org

Post received from mailinglist
Guest
Posted: Fri Dec 11, 2009 10:08 pm Reply with quote
Guest
On Fri, Dec 11, 2009 at 3:20 PM, Simon Cornish <zl9d97p02@sneakemail.com> wrote:
> Regarding the internal consistency check, I used the beam_bool patch
> and still encountered the same problem. Attached is a small example.
> It will compile if no_bopt is used. It will also compile if the
> boolean guard is not repeated (eg. CH2 is assigned a constant value).

Fixed. Included in 'pu'.

--
Björn Gustavsson, Erlang/OTP, Ericsson AB

________________________________________________________________
erlang-bugs mailing list. See http://www.erlang.org/faq.html
erlang-bugs (at) erlang.org

Post received from mailinglist
Guest
Posted: Fri Dec 11, 2009 10:42 pm Reply with quote
Guest
2009/12/11 Bj

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum