Erlang/OTP Forums

Author Message

<  Erlang bugs mailing list  ~  Compiler crash using abstract modules

mscandar at cisco.com
Posted: Sun Nov 14, 2004 4:48 am Reply with quote
Guest
Compiling:

-module(foo, [A]).
-export([bar/1]).

-record(s, {a}).


bar(S) when S#s.a == 0 -> any_term.


Produces:

4> c(foo).
./foo.erl:none: internal error in expand_module;
crash reason: {function_clause,[{sys_expand_pmod,
gexpr,
[{call,
7,
{remote,
7,
{atom,7,erlang},
{atom,7,element}},
[{integer,7,2},{var,7,'S'}]},
{pmod,
['A'],
[{bar,1},
{module_info,0},
{module_info,1}],
[{bar,1},
{module_info,0},
{module_info,1}]}]},
{sys_expand_pmod,guard_test,2},
{sys_expand_pmod,guard0,2},
{sys_expand_pmod,guard,2},
{sys_expand_pmod,clause,2},
{sys_expand_pmod,clauses,2},
{sys_expand_pmod,function,4},
{sys_expand_pmod,form,2},
{sys_expand_pmod,forms,2},
{sys_expand_pmod,forms,4}]}
error
5>


The following don't crash:

bar(#s{a=0}) -> any_term.

bar(S) when S#s.a -> any_term.

bar(S) when is_integer(S#s.a) -> whatever.

Very interesting!

Mark.


Post generated using Mail2Forum (http://m2f.sourceforge.net)
richardc at csd.uu.se
Posted: Sun Nov 14, 2004 3:55 pm Reply with quote
Guest
Mark Scandariato wrote:
> Compiling:
>
> -module(foo, [A]).
> -export([bar/1]).
> -record(s, {a}).
> bar(S) when S#s.a == 0 -> any_term.
>
> Produces:
>
> 4> c(foo).
> ./foo.erl:none: internal error in expand_module;
> crash reason: {function_clause,[{sys_expand_pmod,

There had been some code rot in the expansion module,
due to changes in other parts of the compiler. The
attached file (lib/compiler/src/sys_expand_pmod.erl)
should fix this, as well as some other problems I
found when going over the code.

/Richard


Post generated using Mail2Forum (http://m2f.sourceforge.net)

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