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 consistency check failed #8617

Closed
RobinMorisset opened this issue Jun 26, 2024 · 1 comment · Fixed by #8622
Closed

[erlc] internal consistency check failed #8617

RobinMorisset opened this issue Jun 26, 2024 · 1 comment · Fixed by #8622
Assignees
Labels
bug Issue is reported as a bug team:VM Assigned to OTP team VM

Comments

@RobinMorisset
Copy link
Contributor

Describe the bug

-module(test883181).
-export([f1/0]).

f1() ->
    [ 0 || <<_:0, _V2:(tuple_size({self()}))>> <= <<>>, (self() ! [ 0 ||  _V2])].

crashes erlc with the error message:

test883181:1: function '-f1/0-lc$^0/1-0-'/1+10:
  Internal consistency check failed - please report this bug.
  Instruction: {bs_match,{f,0},{x,0},{commands,[{skip,1}]}}
  Error:       throws_exception:

Affected versions

  • master

Additional context
This might be another instance of #7342, I'm reporting it because I don't remember seeing this particular error message before (usually there is {bad_type_arg, ...} where there is just throws_exception here).

@RobinMorisset RobinMorisset added the bug Issue is reported as a bug label Jun 26, 2024
@bjorng bjorng added the team:VM Assigned to OTP team VM label Jun 27, 2024
@bjorng bjorng self-assigned this Jun 27, 2024
@bjorng
Copy link
Contributor

bjorng commented Jun 27, 2024

Thanks!

This is not an instance of #7342, but an interaction between the CSE optimizations and binary matching optimizations.

bjorng added a commit to bjorng/otp that referenced this issue Jun 27, 2024
The common sub expression (CSE) optimization could cause a call to a
guard BIF to be inserted into the middle of a sequence of binary
syntax matching instructions, which in turn could cause unsafe
`bs_match` (BEAM) instructions to be emitted.

Resolves erlang#8617
@bjorng bjorng closed this as completed in 60f8f9e Jun 28, 2024
bjorng added a commit that referenced this issue Jun 28, 2024


Fix unsafe code generation for binary matching
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.

2 participants