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

Incorrect pattern matching results using OTP 19.0.x on some platforms #5586

Closed
scouten opened this issue Dec 23, 2016 · 2 comments
Closed

Incorrect pattern matching results using OTP 19.0.x on some platforms #5586

scouten opened this issue Dec 23, 2016 · 2 comments

Comments

@scouten
Copy link

scouten commented Dec 23, 2016

I've identified what looks like a bug in pattern matching (function head selection) in OTP 19.0.x, but only on some platforms.

Environment

  • Elixir versions tested: 1.2, 1.3.0, 1.3.2, 1.3.4 (happens in all versions)
  • OTP versions tested: 18.0, 19.0, 19.1, 19.2 (happens only in OTP 19.0)
  • Operating systems tested: Ubuntu 12.04.5 LTS, Mac OS 10.11.6 (happens only on Ubuntu)

Current behavior

A minimal repro case (one file, one test) is available at https://github.com/scouten/otp-pattern-match. This is a very stripped down version of sqlitex, where I first encountered the bug.

If you examine the Travis CI build logs at https://travis-ci.org/scouten/otp-pattern-match/builds/186425073, you'll see that the test fails on OTP 19.0, but succeeds on 18.0, 19.1, and 19.2.

The bug is essentially that the code fails to match the translate_value clause at https://github.com/scouten/otp-pattern-match/blob/master/lib/pattern_match_bug.ex#L11 in my example. It instead falls through to the catch-all clause at line 23 and thus generates an unwanted result.

Expected behavior

Test matches https://github.com/scouten/otp-pattern-match/blob/master/lib/pattern_match_bug.ex#L11 on all OTP versions.

@scouten
Copy link
Author

scouten commented Dec 23, 2016

This is likely an OTP bug (and could well be closed as such), but wanted to make sure Elixir core team was aware of it.

I will discontinue testing my code on OTP 19.0 for now. 🙂

@josevalim
Copy link
Member

It is a known bug that has been fixed. Here is the test case added to OTP: erlang/otp@8b83bc0

Since it was fixed on later 19.0 releases, I believe the OS difference is caused by the version in the OS package manager.

Thanks for the report!

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

No branches or pull requests

2 participants