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

The pin doesn't pin #12407

Closed
michalmuskala opened this issue Feb 16, 2023 · 3 comments
Closed

The pin doesn't pin #12407

michalmuskala opened this issue Feb 16, 2023 · 3 comments

Comments

@michalmuskala
Copy link
Member

michalmuskala commented Feb 16, 2023

Elixir and Erlang/OTP versions

Erlang/OTP 25 [erts-13.1.4] [source] [64-bit] [smp:10:10] [ds:10:10:10] [async-threads:1] [jit] [dtrace]

Elixir 1.14.3 (compiled with Erlang/OTP 25)

Operating system

macOS

Current behavior

Given the following module:

defmodule Test do
  def test() do
    zero = 0
    one = 1

    result = ^one = zero
    IO.inspect({zero, one})
    result
  end
end

Running Test.test() outputs:

iex(1)> Test.test()
{0, 0}
0

Expected behavior

The code should fail with a match error.

This is caused by an issue in Erlang: erlang/otp#6873. The issue exists at least in OTP 24 and 25. The current OTP master does not present it.
However, given how serious in terms of language semantics the issue is, I decided to report it here as well - Elixir might want to employ some sort of mitigation through compiling to a different code pattern.

@josevalim
Copy link
Member

Thank you!

@sopotc
Copy link

sopotc commented Feb 16, 2023

The issue exists at least in OTP 24 and 25

Also in 23 as confirmed by OTP.

@josevalim
Copy link
Member

Closing as it has been backported to OTP 23, 24, 25. Thanks @michalmuskala !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants