Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Dialyzer] Function clause with 26.1 possibly related to opaque types #7676

Open
Olivier-Boudeville opened this issue Sep 23, 2023 · 1 comment · Fixed by #7682
Open

[Dialyzer] Function clause with 26.1 possibly related to opaque types #7676

Olivier-Boudeville opened this issue Sep 23, 2023 · 1 comment · Fixed by #7682
Assignees
Labels
bug Issue is reported as a bug team:VM Assigned to OTP team VM

Comments

@Olivier-Boudeville
Copy link

When generating a PLT for the code in https://github.com/Olivier-Boudeville/Ceylan-Myriad/tree/opengl-augmentation (at least with Erlang 26.1) the following Dialyzer crash happens, possibly in link with the management of opaque types:

Adding information from [...]/Erlang/Erlang-26.1/Erlang.plt to ./Ceylan-Myriad.plt...
=ERROR REPORT==== 23-Sep-2023::12:37:04.894715 ===
Error in process <0.6231.0> with exit value:
{function_clause,[{lists,zipwith,
                         [#Fun<erl_types.3.94731349>,any,any,fail],
                         [{file,"lists.erl"},{line,568}]},
                  {erl_types,t_find_opaque_mismatch_ordlists,4,
                             [{file,"erl_types.erl"},{line,563}]},
                  {lists,zipwith,4,[{file,"lists.erl"},{line,569}]},
                  {lists,zipwith,4,[{file,"lists.erl"},{line,569}]},
                  {erl_types,t_find_opaque_mismatch_ordlists,4,
                             [{file,"erl_types.erl"},{line,563}]},
                  {erl_types,'-t_find_opaque_mismatch_lists/4-lc$^1/1-1-',5,
                             [{file,"erl_types.erl"},{line,569}]},
                  {erl_types,'-t_find_opaque_mismatch_lists/4-lc$^1/1-1-',5,
                             [{file,"erl_types.erl"},{line,571}]},
                  {erl_types,t_find_opaque_mismatch_lists,4,
                             [{file,"erl_types.erl"},{line,571}]}]}

=ERROR REPORT==== 23-Sep-2023::12:37:04.895325 ===
Error in process <0.6348.0> with exit value:
{badarg,[{ets,member,
              [#Ref<0.3545108582.3889561601.197597>,81441],
              [{error_info,#{cause => id,module => erl_stdlib_errors}}]},
         {dialyzer_callgraph,ets_lookup_set,2,
                             [{file,"dialyzer_callgraph.erl"},{line,348}]},
         {dialyzer_dataflow,init_fun_tab,5,
                            [{file,"dialyzer_dataflow.erl"},{line,3123}]},
         {dialyzer_dataflow,state__new,6,
                            [{file,"dialyzer_dataflow.erl"},{line,2889}]},
         {dialyzer_dataflow,analyze_module,6,
                            [{file,"dialyzer_dataflow.erl"},{line,149}]},
         {dialyzer_dataflow,get_fun_types,5,
                            [{file,"dialyzer_dataflow.erl"},{line,136}]},
         {dialyzer_succ_typings,refine_one_module,2,
                                [{file,"dialyzer_succ_typings.erl"},
                                 {line,162}]},
         {dialyzer_worker,run,1,[{file,"dialyzer_worker.erl"},{line,70}]}]}

=ERROR REPORT==== 23-Sep-2023::12:37:04.895580 ===
Error in process <0.6307.0> with exit value:
{badarg,[{ets,lookup_element,
              [#Ref<0.3545108582.3889561601.197598>,4028,2,error],
              [{error_info,#{cause => id,module => erl_stdlib_errors}}]},
         {dialyzer_callgraph,ets_lookup_dict,2,
                             [{file,"dialyzer_callgraph.erl"},{line,342}]},
         {dialyzer_succ_typings,lookup_name,2,
                                [{file,"dialyzer_succ_typings.erl"},
                                 {line,457}]},
         {dialyzer_succ_typings,lookup_fun_type,4,
                                [{file,"dialyzer_succ_typings.erl"},
                                 {line,428}]},
         {dialyzer_succ_typings,get_fun_types_from_plt,4,
                                [{file,"dialyzer_succ_typings.erl"},
                                 {line,412}]},
         {dialyzer_succ_typings,refine_one_module,2,
                                [{file,"dialyzer_succ_typings.erl"},
                                 {line,159}]},
         {dialyzer_worker,run,1,[{file,"dialyzer_worker.erl"},{line,70}]}]}

=ERROR REPORT==== 23-Sep-2023::12:37:04.895829 ===
Error in process <0.6322.0> with exit value:
{badarg,[{ets,lookup_element,
              [#Ref<0.3545108582.3889561601.197598>,882401,2,error],
              [{error_info,#{cause => id,module => erl_stdlib_errors}}]},
         {dialyzer_callgraph,ets_lookup_dict,2,
                             [{file,"dialyzer_callgraph.erl"},{line,342}]},
         {dialyzer_succ_typings,lookup_name,2,
                                [{file,"dialyzer_succ_typings.erl"},
                                 {line,457}]},
         {dialyzer_succ_typings,lookup_fun_type,4,
                                [{file,"dialyzer_succ_typings.erl"},
                                 {line,428}]},
         {dialyzer_succ_typings,get_fun_types_from_plt,4,
                                [{file,"dialyzer_succ_typings.erl"},
                                 {line,412}]},
         {dialyzer_succ_typings,refine_one_module,2,
                                [{file,"dialyzer_succ_typings.erl"},
                                 {line,159}]},
         {dialyzer_worker,run,1,[{file,"dialyzer_worker.erl"},{line,70}]}]}

=ERROR REPORT==== 23-Sep-2023::12:37:04.895867 ===
Error in process <0.6234.0> with exit value:
{badarg,[{ets,lookup_element,
              [#Ref<0.3545108582.3889561601.197598>,86939,2,error],
              [{error_info,#{cause => id,module => erl_stdlib_errors}}]},
         {dialyzer_callgraph,ets_lookup_dict,2,
                             [{file,"dialyzer_callgraph.erl"},{line,342}]},
         {dialyzer_succ_typings,lookup_name,2,
                                [{file,"dialyzer_succ_typings.erl"},
                                 {line,457}]},
         {dialyzer_succ_typings,lookup_fun_type,4,
                                [{file,"dialyzer_succ_typings.erl"},
                                 {line,428}]},
         {dialyzer_succ_typings,get_fun_types_from_plt,4,
                                [{file,"dialyzer_succ_typings.erl"},
                                 {line,412}]},
         {dialyzer_succ_typings,refine_one_module,2,
                                [{file,"dialyzer_succ_typings.erl"},
                                 {line,159}]},
         {dialyzer_worker,run,1,[{file,"dialyzer_worker.erl"},{line,70}]}]}

=ERROR REPORT==== 23-Sep-2023::12:37:04.896375 ===
Error in process <0.6361.0> with exit value:
{badarg,[{ets,lookup_element,
              [#Ref<0.3545108582.3889561601.197598>,874364,2,error],
              [{error_info,#{cause => id,module => erl_stdlib_errors}}]},
         {dialyzer_callgraph,ets_lookup_dict,2,
                             [{file,"dialyzer_callgraph.erl"},{line,342}]},
         {dialyzer_succ_typings,lookup_name,2,
                                [{file,"dialyzer_succ_typings.erl"},
                                 {line,457}]},
         {dialyzer_succ_typings,lookup_fun_type,4,
                                [{file,"dialyzer_succ_typings.erl"},
                                 {line,428}]},
         {dialyzer_succ_typings,get_fun_types_from_plt,4,
                                [{file,"dialyzer_succ_typings.erl"},
                                 {line,412}]},
         {dialyzer_succ_typings,refine_one_module,2,
                                [{file,"dialyzer_succ_typings.erl"},
                                 {line,159}]},
         {dialyzer_worker,run,1,[{file,"dialyzer_worker.erl"},{line,70}]}]}

=ERROR REPORT==== 23-Sep-2023::12:37:04.896401 ===
Error in process <0.6343.0> with exit value:
{badarg,[{ets,lookup_element,
              [#Ref<0.3545108582.3889561601.197598>,595914,2,error],
              [{error_info,#{cause => id,module => erl_stdlib_errors}}]},
         {dialyzer_callgraph,ets_lookup_dict,2,
                             [{file,"dialyzer_callgraph.erl"},{line,342}]},
         {dialyzer_succ_typings,lookup_name,2,
                                [{file,"dialyzer_succ_typings.erl"},
                                 {line,457}]},
         {dialyzer_succ_typings,lookup_fun_type,4,
                                [{file,"dialyzer_succ_typings.erl"},
                                 {line,428}]},
         {dialyzer_succ_typings,get_fun_types_from_plt,4,
                                [{file,"dialyzer_succ_typings.erl"},
                                 {line,412}]},
         {dialyzer_succ_typings,refine_one_module,2,
                                [{file,"dialyzer_succ_typings.erl"},
                                 {line,159}]},
         {dialyzer_worker,run,1,[{file,"dialyzer_worker.erl"},{line,70}]}]}

=ERROR REPORT==== 23-Sep-2023::12:37:04.896763 ===
Error in process <0.6232.0> with exit value:
{badarg,[{ets,lookup_element,
              [#Ref<0.3545108582.3889561601.197598>,769894,2,error],
              [{error_info,#{cause => id,module => erl_stdlib_errors}}]},
         {dialyzer_callgraph,ets_lookup_dict,2,
                             [{file,"dialyzer_callgraph.erl"},{line,342}]},
         {dialyzer_succ_typings,lookup_name,2,
                                [{file,"dialyzer_succ_typings.erl"},
                                 {line,457}]},
         {dialyzer_succ_typings,lookup_fun_type,4,
                                [{file,"dialyzer_succ_typings.erl"},
                                 {line,428}]},
         {dialyzer_succ_typings,get_fun_types_from_plt,4,
                                [{file,"dialyzer_succ_typings.erl"},
                                 {line,412}]},
         {dialyzer_succ_typings,refine_one_module,2,
                                [{file,"dialyzer_succ_typings.erl"},
                                 {line,159}]},
         {dialyzer_worker,run,1,[{file,"dialyzer_worker.erl"},{line,70}]}]}


dialyzer: Analysis failed with error:
{function_clause,[{lists,zipwith,
                         [#Fun<erl_types.3.94731349>,any,any,fail],
                         [{file,"lists.erl"},{line,568}]},
                  {erl_types,t_find_opaque_mismatch_ordlists,4,
                             [{file,"erl_types.erl"},{line,563}]},
                  {lists,zipwith,4,[{file,"lists.erl"},{line,569}]},
                  {lists,zipwith,4,[{file,"lists.erl"},{line,569}]},
                  {erl_types,t_find_opaque_mismatch_ordlists,4,
                             [{file,"erl_types.erl"},{line,563}]},
                  {erl_types,'-t_find_opaque_mismatch_lists/4-lc$^1/1-1-',5,
                             [{file,"erl_types.erl"},{line,569}]},
                  {erl_types,'-t_find_opaque_mismatch_lists/4-lc$^1/1-1-',5,
                             [{file,"erl_types.erl"},{line,571}]},
                  {erl_types,t_find_opaque_mismatch_lists,4,
                             [{file,"erl_types.erl"},{line,571}]}]}
Last messages in the log cache:
  Reading files and computing callgraph... done in 0.47 secs
  Removing edges... done in 0.05 secs
=ERROR REPORT==== 23-Sep-2023::12:37:04.907694 ===
Error in process <0.6257.0> with exit value:
{badarg,[{ets,lookup_element,
              [#Ref<0.3545108582.3889561608.192567>,text_utils,2,ok],
              [{error_info,#{cause => id,module => erl_stdlib_errors}}]},
         {dialyzer_coordinator,'-wait_for_success_typings/2-fun-0-',2,
                               [{file,"dialyzer_coordinator.erl"},{line,141}]},
         {lists,foreach_1,2,[{file,"lists.erl"},{line,1686}]},
         {dialyzer_worker,init,1,[{file,"dialyzer_worker.erl"},{line,61}]}]}

Looking at the last badarg, this may happen when analysing my text_utils module in https://github.com/Olivier-Boudeville/Ceylan-Myriad/blob/opengl-augmentation/src/utils/text_utils.erl

Hope this helps.

Thanks!

Olivier.

@Olivier-Boudeville Olivier-Boudeville added the bug Issue is reported as a bug label Sep 23, 2023
@garazdawi garazdawi added the team:VM Assigned to OTP team VM label Sep 25, 2023
@jhogberg jhogberg self-assigned this Sep 25, 2023
@jhogberg
Copy link
Contributor

Thanks for your report, #7682 ought to fix it :)

jhogberg added a commit that referenced this issue Nov 6, 2023
…72' into maint

* john/dialyzer/fix-opaque-mismatch-crash/GH-7676/OTP-18772:
  erl_types: Fix crash in contract checking
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue is reported as a bug team:VM Assigned to OTP team VM
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants