Skip to content

[erlc] internal error in pass core, involving a compr_assign hidden in begin..end #11352

Description

@RobinMorisset

Describe the bug
Running erlc on the following code:

-module(v3_core_add_pre_bound_vars).
-export([]).

f6() ->
    #{
        ok => ok
     || <<>> = [] := _ <- ok,
        begin
            _ = ok
        end
    }.

results in the following crash:

Function: f6/0
found_bugs/v3_core_add_pre_bound_vars.erl: internal error in pass core:
exception error: no function clause matching ordsets:union([6,'_'],nomatch) 
  in function  v3_core:add_pre_bound_vars/2 (v3_core.erl:2913)
  in call from v3_core:filter_tq/7 (v3_core.erl:2286)
  in call from v3_core:lc_tq1/5 (v3_core.erl:1963)
  in call from v3_core:mc_tq/5 (v3_core.erl:2231)
  in call from v3_core:exprs/2 (v3_core.erl:785)
  in call from v3_core:clause/2 (v3_core.erl:450)
  in call from v3_core:clauses/2 (v3_core.erl:441)

Affected versions
9c28888, which is master at the time I'm writing this issue.

Additional context
Adding -feature(compr_assign, enable). does not change the result.
Removing the begin..end wrapping around the assignment does change the result: either a clean error message if the feature is disabled saying to enable it, or the code compiles fine if it is enabled.

Metadata

Metadata

Assignees

Labels

bugIssue is reported as a bugteam:VMAssigned to OTP team VM

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions