[erlang-questions] Why does Dialyzer crash on this map?

Ivan Uemlianin <>
Thu Nov 27 13:20:08 CET 2014


Dear Dave

Thanks for your help.  Here are some more details:


*** OS: FreeBSD 10.0-RELEASE

$ uname -a
FreeBSD simba 10.0-RELEASE FreeBSD 10.0-RELEASE #0 r260789: Thu Jan 16 
22:34:59 UTC 2014 :/usr/obj/usr/src/sys/GENERIC  amd64

Upgrading to 10.1 is on my todo list.


*** Erlang version now 17.3_3,3

$ pkg info erlang
erlang-17.3_1,3
...
$ sudo pkg upgrade
...

$ pkg info erlang
erlang-17.3_3,3
...


*** Errors persist

Upgrading erlang has not changed behaviour.

A couple more observations:

1. Running dialyzer on the module dt below gets the error as noted 
previously.  However, if I uncomment the '%% ok' line, dialyzer will 
process the module with no problems.

     -module(dt).
     -export([get_map/0]).

     -spec get_map() -> map().
     get_map() ->
         #{labels => [one, two],
           number => 27,
%%          [1,2,3] => wer,        %% ok
           kvok => #{
                 a => qwe,
                 2 => asd,
                 [1,2,3] => wer,  %% bad
                 {4,5,6} => sdf,  %% bad
                 "abc" => zxc
            }
          }.

     $ dialyzer dt.erl
       Checking whether the PLT /home/ivan/.dialyzer_plt is 
up-to-date... yes
       Proceeding with analysis...
     =ERROR REPORT==== 27-Nov-2014::12:17:02 ===
     Error in process <0.45.0> with exit value: 
{{case_clause,map},[{dialyzer_dataflow,find_terminals,1,[{file,"dialyzer_dataflow.erl"},{line,3451}]},{dialyzer_dataflow,find_terminals_list,3,[{file,"dialyzer_dataflow.erl"},{line,3504}]},{dialyzer_dataflow,classify_returns... 



     dialyzer: Analysis failed with error:
     {{case_clause,map},
      [{dialyzer_dataflow,find_terminals,1,
[{file,"dialyzer_dataflow.erl"},{line,3451}]},
       {dialyzer_dataflow,find_terminals_list,3,
[{file,"dialyzer_dataflow.erl"},{line,3504}]},
       {dialyzer_dataflow,classify_returns,1,
[{file,"dialyzer_dataflow.erl"},{line,3443}]},
       {dialyzer_dataflow,'-state__get_warnings/2-fun-0-',7,
[{file,"dialyzer_dataflow.erl"},{line,2908}]},
       {lists,foldl,3,[{file,"lists.erl"},{line,1261}]},
       {dialyzer_dataflow,state__get_warnings,2,
[{file,"dialyzer_dataflow.erl"},{line,2934}]},
       {dialyzer_dataflow,get_warnings,5,
[{file,"dialyzer_dataflow.erl"},{line,142}]},
       {dialyzer_succ_typings,collect_warnings,2,
[{file,"dialyzer_succ_typings.erl"},{line,182}]}]}
     Last messages in the log cache:
       Reading files and computing callgraph... done in 0.07 secs
       Removing edges... done in 0.00 secs


2. Running dialyzer on the module dt2 below raises the warning 
following.  Uncommenting the '%% ok' line has no effect.

     -module(dt2).
     -export([get_map/0]).

     -spec get_map() -> map().
     get_map() ->
         X = #{labels => [one, two],
           number => 27,
%%          [1,2,3] => wer,        %% ok
           kvok => #{
                 a => qwe,
                 2 => asd,
                 [1,2,3] => wer,  %% bad
                 {4,5,6} => sdf,  %% bad
                 "abc" => zxc
            }
          },
         X.

     $ dialyzer dt2.erl
       Checking whether the PLT /home/ivan/.dialyzer_plt is 
up-to-date... yes
       Proceeding with analysis...
     dt2.erl:5: Function get_map/0 has no local return
      done in 0m0.41s
     done (warnings were emitted)

Best wishes

Ivan



On 11/25/14 20:37, Dave Cottlehuber wrote:
> Sorry about that last email …
>
> EWORKSFORME.
>
> FreeBSD 10.1 amd64, erlang-17.3_2,3 from pkg.
>
> What FreeBSD & erlang are you using?
>
> dch   /tmp ❯❯❯   dialyzer --build_plt --apps erts kernel stdlib
>    Creating PLT /home/dch/.dialyzer_plt ...
> Unknown functions:
>    compile:file/2
>    compile:forms/2
>    compile:noenv_forms/2
>    compile:output_generated/1
>    crypto:block_decrypt/4
>    crypto:start/0
> Unknown types:
>    compile:option/0
>   done in 1m8.53s
> done (passed successfully)
>
> dch   /tmp ❯❯❯dialyzer ltu.erl
>    Checking whether the PLT /home/dch/.dialyzer_plt is up-to-date... yes
>    Proceeding with analysis... done in 0m0.41s
> done (passed successfully)
>
> dch   /tmp ❯❯❯erl
> Erlang/OTP 17 [erts-6.2] [source] [64-bit] [smp:8:8] [async-threads:64] [kernel-poll:true]
>
> Eshell V6.2  (abort with ^G)
> 1>
>
> A+, Dave
> — sent from my Couch
>
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions

-- 
============================================================
Ivan A. Uemlianin PhD
Llaisdy
Speech Technology Research and Development

                     
                         @llaisdy
                          llaisdy.wordpress.com
               github.com/llaisdy
                      www.linkedin.com/in/ivanuemlianin

                         festina lente
============================================================



More information about the erlang-questions mailing list