8000 erlc internal consistency error for is_eq_exact · Issue #6183 · erlang/otp · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

erlc internal consistency error for is_eq_exact #6183

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

Closed
RobinMorisset opened this issue Jul 29, 2022 · 1 comment · Fixed by #6189
Closed

erlc internal consistency error for is_eq_exact #6183

RobinMorisset opened this issue Jul 29, 2022 · 1 comment · Fixed by #6189
Assignees
Labels
bug Issue is reported as a bug in progress

Comments

@RobinMorisset
Copy link
Contributor

On the following code:

-module(is_eq_exact).
-compile([export_all]).

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

erlc (either built from master as of today including the recent fixes to #6163, #6164, and #6169, or a slightly older version from a few weeks ago) crashes with the following error message:

is_eq_exact:1: function f/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]}}:

@RobinMorisset RobinMorisset added the bug Issue is reported as a bug label Jul 29, 2022
@bjorng bjorng self-assigned this Jul 31, 2022
bjorng added a commit to bjorng/otp that referenced this issue 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 erlang#6183
@bjorng
Copy link
Contributor
bjorng commented Aug 1, 2022

I have fixed the problem in the linked pull request.

bjorng added a commit to bjorng/otp that referenced this issue Aug 2, 2022
…er/primary_preloaded

* bjorn/compiler/not-equal/erlangGH-6183:
  Eliminate internal consistency failure
@bjorng bjorng closed this as completed in f05b757 Aug 3, 2022
bjorng added a commit that referenced this issue Aug 3, 2022
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 in progress
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants
0