Compiler crash using abstract modules

Mark Scandariato <>
Sun Nov 14 05:47:47 CET 2004


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.



More information about the erlang-bugs mailing list