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

[erlc] internal error in pass beam_kernel_to_ssa with maybe #6601

Closed
RobinMorisset opened this issue Dec 29, 2022 · 0 comments · Fixed by #6629
Closed

[erlc] internal error in pass beam_kernel_to_ssa with maybe #6601

RobinMorisset opened this issue Dec 29, 2022 · 0 comments · Fixed by #6629
Assignees
Labels
bug Issue is reported as a bug team:VM Assigned to OTP team VM

Comments

@RobinMorisset
Copy link
Contributor

On the following file:

-feature(maybe_expr, enable).
-module(maybe819).

f({X}) -> 
    maybe 
        <<_:(ok)>> ?= X
    end.

erlc crashes with the following error message:

Function: f/1
minimized/final_maybe819.erl: internal error in pass beam_kernel_to_ssa:
exception error: bad key: 8
  in function  map_get/2
     called as map_get(8,#{0 => {b_var,0},9 => {b_var,9},'@ssa_ret' => {b_var,'@ssa_ret'}})
     *** argument 1: not present in map
  in call from beam_kernel_to_ssa:ssa_arg/2 (beam_kernel_to_ssa.erl, line 1127)
  in call from beam_kernel_to_ssa:'-cg/2-lc$^0/1-0-'/2 (beam_kernel_to_ssa.erl, line 1125)
  in call from beam_kernel_to_ssa:cg/2 (beam_kernel_to_ssa.erl, line 1125)
  in call from beam_kernel_to_ssa:cg/2 (beam_kernel_to_ssa.erl, line 142)
  in call from beam_kernel_to_ssa:select_val/4 (beam_kernel_to_ssa.erl, line 495)
  in call from beam_kernel_to_ssa:'-select_cg/5-anonymous-0-'/4 (beam_kernel_to_ssa.erl, line 217)
  in call from lists:mapfoldl_1/3 (lists.erl, line 1588)

Here is another testcase with a very similar error message:

f() -> 
    {X} = fun () -> ok end,
    maybe 
        (1 = 2) ?= X
    end.
@RobinMorisset RobinMorisset added the bug Issue is reported as a bug label Dec 29, 2022
@rickard-green rickard-green added the team:VM Assigned to OTP team VM label Jan 2, 2023
jhogberg added a commit that referenced this issue Jan 5, 2023
…aint

* john/compiler/fix-maybe-crash/GH-6601/OTP-18381:
  v3_kernel: Mark #k_goto{} arguments as used
@bjorng bjorng closed this as completed Jan 5, 2023
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.

4 participants