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] another internal error in pass beam_validator_strong #7171

Closed
RobinMorisset opened this issue Apr 25, 2023 · 0 comments · Fixed by #7173
Closed

[erlc] another internal error in pass beam_validator_strong #7171

RobinMorisset opened this issue Apr 25, 2023 · 0 comments · Fixed by #7173
Assignees
Labels
bug Issue is reported as a bug team:VM Assigned to OTP team VM

Comments

@RobinMorisset
Copy link
Contributor

RobinMorisset commented Apr 25, 2023

Describe the bug
Running erlc on the following code:

f(<<X/utf8>>) ->
    case 9223372036854775807 - abs(X) of
        Y when X < Y ->
            ok;
        9223372036854775807 ->
            ok;
        -2147483648 ->
            ok
    end.

results in the following error:

Function: f/1
/home/rmorisset/minimized/erlc_opts_5.erl: internal error in pass beam_validator_strong:
exception error: no match of right hand side value false
  in function  beam_validator:unpack_typed_arg/2 (beam_validator.erl, line 2833)
  in call from beam_validator:vi/2 (beam_validator.erl, line 513)
  in call from beam_validator:validate_instrs/4 (beam_validator.erl, line 333)
  in call from beam_validator:validate_1/5 (beam_validator.erl, line 276)
  in call from beam_validator:validate_0/4 (beam_validator.erl, line 114)
  in call from beam_validator:validate/2 (beam_validator.erl, line 56)
  in call from compile:beam_validator_1/3 (compile.erl, line 1682)
  in call from compile:fold_comp/4 (compile.erl, line 410)

Affected versions

Additional context
Despite having a near-identical stack trace to #7147, I believe that this is a different bug as it is not fixed by #7163.

With the commit 039c5de, we get the following slightly more informative error message instead:

erlc_opts_5:1: function f/1+18:
  Internal consistency check failed - please report this bug.
  Instruction: {test,is_eq_exact,
                     {f,12},
                     [{tr,{x,0},
                          {t_integer,{9223372036853661696,
                                      9223372036854775807}}},
                      {integer,-2147483648}]}
  Error:       {bad_typed_register,
                   {t_integer,{'-inf',1114111}},
                   {t_integer,{9223372036853661696,9223372036854775807}}}:
@RobinMorisset RobinMorisset added the bug Issue is reported as a bug label Apr 25, 2023
@RobinMorisset RobinMorisset changed the title [erlc] Another internal error in pass beam_validator_strong [erlc] another internal error in pass beam_validator_strong Apr 25, 2023
@bjorng bjorng added the team:VM Assigned to OTP team VM label Apr 26, 2023
jhogberg added a commit to jhogberg/otp that referenced this issue Apr 26, 2023
jhogberg added a commit to jhogberg/otp that referenced this issue Apr 26, 2023
jhogberg added a commit to jhogberg/otp that referenced this issue Apr 26, 2023
@jhogberg jhogberg self-assigned this Apr 26, 2023
jhogberg added a commit that referenced this issue Apr 27, 2023
…r-range-inference/GH-7171

beam_validator: Improve arithmetic range inference
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