Skip to content

Instantly share code, notes, and snippets.

@josevalim
Created October 21, 2012 17:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save josevalim/dd4c1240a1510711b26a to your computer and use it in GitHub Desktop.
Save josevalim/dd4c1240a1510711b26a to your computer and use it in GitHub Desktop.
Current code can't compile, it blows up Erlang internals
-module(format_test).
-export([format/2]).
format(Datetime, << H, T / binary >>) when not ((H >= $a) andalso (H =< $z)) andalso
not ((H >= $A) andalso (H =< $Z)) ->
{ Datetime, T }.

Info

I am working on Mac OS X, Snow Leopard.

Current Erlang version is:

Erlang R15B02 (erts-5.9.2) [source] [64-bit] [smp:4:4] [async-threads:0] [hipe] [kernel-poll:false] [dtrace]

The error occurs when processing the guard clause. I am aware this same guard clause could be written in different ways and the current failure could be avoided. However, I believe this is valid Erlang code and it should not blow up the compiler chain. :)

See file 2_Stacktrace for more information about the failure.

Function: format/2
lib/elixir/test/erlang/atom_test.erl:none: internal error in v3_codegen;
crash reason: {{case_clause,
{'EXIT',
{function_clause,
[{v3_codegen,bsm_rename_ctx,
[{l,
{call,
{remote,{atom,erlang},{atom,error}},
[{atom,badarg}],
[{var,ker13}]},
19,[],
[compiler_generated,7,
{file,"lib/elixir/test/erlang/atom_test.erl"}]},
ker2,cor0,true],
[{file,"v3_codegen.erl"},{line,323}]},
{v3_codegen,bsm_rename_ctx_list,4,
[{file,"v3_codegen.erl"},{line,388}]},
{v3_codegen,bsm_rename_ctx,4,
[{file,"v3_codegen.erl"},{line,380}]},
{v3_codegen,bsm_rename_ctx,4,
[{file,"v3_codegen.erl"},{line,345}]},
{v3_codegen,bsm_rename_ctx,4,
[{file,"v3_codegen.erl"},{line,367}]},
{v3_codegen,bsm_rename_ctx_list,4,
[{file,"v3_codegen.erl"},{line,388}]},
{v3_codegen,bsm_rename_ctx_list,4,
[{file,"v3_codegen.erl"},{line,389}]},
{v3_codegen,bsm_rename_ctx,4,
[{file,"v3_codegen.erl"},{line,361}]}]}}},
[{compile,'-select_passes/2-anonymous-2-',2,
[{file,"compile.erl"},{line,473}]},
{compile,'-internal_comp/4-anonymous-1-',2,
[{file,"compile.erl"},{line,273}]},
{compile,fold_comp,3,[{file,"compile.erl"},{line,291}]},
{compile,internal_comp,4,[{file,"compile.erl"},{line,275}]},
{compile,'-do_compile/2-anonymous-0-',2,
[{file,"compile.erl"},{line,152}]}]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment