8000 Eliminate internal consistency failure by bjorng · Pull Request #6189 · erlang/otp · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Eliminate internal consistency failure #6189

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

Merged
merged 1 commit into from
Aug 3, 2022

Conversation

bjorng
Copy link
Contributor
@bjorng bjorng commented Aug 1, 2022

When attempting to compile the following code:

foo(V) when (V / V < (V orelse true)); V; V ->
    (V = (a =/= V)) orelse 0.

the beam_validator pass produces the following message:

t:1: function foo/1+12:
  Internal consistency check failed - please report this bug.
  Instruction: {test,is_eq_exact,{f,9},[{x,1},{atom,true}]}
  Error:       {type_conflict,{t_atom,[true]},{t_atom,[a]}}:

The type conflict mentioned refers to the expression a =/= V. At
the point of its evaluation, V is known to beam_validator to be
the atom true; thus, evaluation of a =/= V is redundant because the
result is always false.

The root cause of the problem is that beam_validator has a stronger
type analysis for =/= expressions than beam_ssa_type. By
strengthening the type analysis for =/= in beam_ssa_type, the
offending redundant tests are removed and beam_validator is again
silent.

Fixes #6183

@bjorng bjorng added team:VM Assigned to OTP team VM fix labels Aug 1, 2022
@bjorng bjorng added this to the OTP-26.0 milestone Aug 1, 2022
@bjorng bjorng self-assigned this Aug 1, 2022
@github-actions
Copy link
Contributor
github-actions bot commented Aug 1, 2022

CT Test Results

       2 files     253 suites   8m 59s ⏱️
   736 tests    733 ✔️ 3 💤 0
3 974 runs  3 971 ✔️ 3 💤 0

Results for commit 8aa4414.

♻️ This comment has been updated with latest results.

To speed up review, make sure that you have read Contributing to Erlang/OTP and that all checks pass.

See the TESTING and DEVELOPMENT HowTo guides for details about how to run test locally.

Artifacts

// Erlang/OTP Github Action Bot

@bjorng bjorng added the testing currently being tested, tag is used by OTP internal CI label Aug 1, 2022
@bjorng bjorng force-pushed the bjorn/compiler/not-equal/GH-6183 branch from d8f7f3d to 8aa4414 Compare August 1, 2022 09:37
@bjorng bjorng removed the testing currently being tested, tag is used by OTP internal CI label Aug 1, 2022
When attempting to compile the following code:

    foo(V) when (V / V < (V orelse true)); V; V ->
        (V = (a =/= V)) orelse 0.

the `beam_validator` pass produces the following message:

    t:1: function foo/1+12:
      Internal consistency check failed - please report this bug.
      Instruction: {test,is_eq_exact,{f,9},[{x,1},{atom,true}]}
      Error:       {type_conflict,{t_atom,[true]},{t_atom,[a]}}:

The type conflict mentioned refers to the expression `a =/= V`. At
the point of its evaluation, `V` is known to `beam_validator` to be
the atom `true`; thus, evaluation of `a =/= V` is redundant because the
result is always `false`.

The root cause of the problem is that `beam_validator` has a stronger
type analysis for `=/=` expressions than `beam_ssa_type`. By
strengthening the type analysis for `=/=` in `beam_ssa_type`, the
offending redundant tests are removed and `beam_validator` is again
silent.

It turns out that stronger type analysis causes a new problem for
code such as:

    foobar(L) when L =/= [], is_list(L), L =/= [], hd(L) ->
        ok.

See the added comment and code in beam_types for a description of
the problem and its solution.

Fixes erlang#6183
@bjorng bjorng force-pushed the bjorn/compiler/not-equal/GH-6183 branch from 8aa4414 to f05b757 Compare August 2, 2022 04:26
@bjorng bjorng added the testing currently being tested, tag is used by OTP internal CI label Aug 2, 2022
@bjorng bjorng merged commit f8564a1 into erlang:master Aug 3, 2022
@bjorng bjorng deleted the bjorn/compiler/not-equal/GH-6183 branch August 3, 2022 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fix team:VM Assigned to OTP team VM testing currently being tested, tag is used by OTP internal CI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

erlc internal consistency error for is_eq_exact
1 participant
0