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

Beta regression: References to what's supposed to be static singleton don't pointer compare as equal on 1.23.0-beta.1 #46371

Closed
hsivonen opened this issue Nov 29, 2017 · 15 comments
Assignees
Labels
C-bug Category: This is a bug. P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Milestone

Comments

@hsivonen
Copy link
Member

Steps to reproduce:

  1. git clone https://github.com/hsivonen/encoding_rs
  2. cd encoding_rs
  3. rustup default beta
  4. cargo test --release

Actual results:

failures:

---- test_labels_names::test_all_labels stdout ----
	thread 'test_labels_names::test_all_labels' panicked at 'assertion failed: `(left == right)`
  left: `Some(Encoding { windows-1252 })`,
 right: `Some(Encoding { windows-1252 })`', src/test_labels_names.rs:11:4
note: Run with `RUST_BACKTRACE=1` for a backtrace.

---- tests::test_label_resolution stdout ----
	thread 'tests::test_label_resolution' panicked at 'assertion failed: `(left == right)`
  left: `Some(Encoding { UTF-8 })`,
 right: `Some(Encoding { UTF-8 })`', src/lib.rs:4419:8

Note how left and right in both cases have the same debug stringification.

The eq implementation assumes that there is one instance of each encoding so it's OK to pointer compare them.

Various previous stable channel releases work. Nightly works. Beta works in debug mode. 1.23.0-beta.1 fails in release mode.

encoding_rs issue, Firefox bug

@kennytm kennytm added C-bug Category: This is a bug. regression-from-stable-to-beta Performance or correctness regression from stable to beta. labels Nov 29, 2017
@nagisa
Copy link
Member

nagisa commented Nov 29, 2017

Will probably be the codegen-units thing. Singleton statics should use linkonce/linkonce_odr linkage, although it is not entirely clear to me whether it is up to user to do so or up to us (the compiler).

cc @michaelwoerister @alexcrichton

EDIT: It is certainly a user responsibility if a singleton common for multiple crate versions is desired.

@michaelwoerister
Copy link
Member

Hm, statics should always have external linkage (we don't use linkonce or linkonce_odr anywhere these days). Maybe the symbol internalizer wrongly decides that it can make multiple internal copies?

@alexcrichton
Copy link
Member

This may also be related to #46239 and fixed by #46253, the IR doesn't obviously contain multiple instances of the static here and there's no codegen units involved, so I'd be surprised if the collector came into this!

@arielb1 arielb1 added T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. P-high High priority labels Nov 30, 2017
@michaelwoerister michaelwoerister self-assigned this Nov 30, 2017
@rillian
Copy link
Contributor

rillian commented Dec 4, 2017

Being fixed by #46253 is possible; I can't reproduce with today's nightly rust. @michaelwoerister, can you make sure that gets into to the next beta, please?

@nagisa
Copy link
Member

nagisa commented Dec 4, 2017

I don't think this was fixed by that PR.

@michaelwoerister
Copy link
Member

@rillian I'll do a backport of #46253 tomorrow.

@nagisa Do you have an alternative theory?

@Mark-Simulacrum Mark-Simulacrum added this to the 1.23 milestone Dec 5, 2017
@michaelwoerister
Copy link
Member

I cannot reproduce this with the latest beta anymore. Could you give it a try, @hsivonen?

Also, regarding the question why crater did not find this issue: it seems that crater does not do optimized builds and thus could not have run into this.

bors added a commit that referenced this issue Dec 22, 2017
Bounce out the layout refactor from beta

@eddyb's #45225 was supposed to get into get into 1.24, but due to an ordering mistake, it had snuck into 1.23.

That wide-effect translation-changing PR had poked LLVM's weak corners and caused many regressions (3 of them have fixes I include here, but also #46897, #46845, #46449, #46371). I don't think it is a good idea to land it in the beta (1.23) because there are bound to be some regressions we didn't patch.

Therefore, I am reverting it in time for stable, along with its related regression fixes.

r? @michaelwoerister (I think)
@pnkfelix
Copy link
Member

Note that @arielb1 claimed that #46925 fixed this regression.

(Though, oddly enough, @michaelwoerister 's statement of being unable to reproduce preceded that PR landing...)

Anyway, without triggering a beta .3 release (that would, if I understand correctly, get the latest commit on the beta channel into rustup), it might be difficult for users to test out the latest beta...

@eddyb
Copy link
Member

eddyb commented Dec 29, 2017

@pnkfelix There was a backport of #46253 before @arielb1 reverted the layout PR and the bugfix backports related to it, from beta.

@pnkfelix
Copy link
Member

@eddyb so was @nagisa wrong when they said that they thought #46253 would not fix this?

@nagisa
Copy link
Member

nagisa commented Dec 30, 2017

Yeah, I probably was wrong. I didn’t look at the example closely enough before making the statement and forgot to edit it later on. Sorry.

@hsivonen
Copy link
Member Author

hsivonen commented Jan 3, 2018

Could you give it a try, @hsivonen?

It seems that stable is 1.22.1 and beta is 1.24.0-beta.1. Those both work. Nightly works, too.

What should I tell rustup to test the latest 1.23?

@michaelwoerister
Copy link
Member

What should I tell rustup to test the latest 1.23?

Good question. @alexcrichton would know best, I guess?

@alexcrichton
Copy link
Member

There's info on how to test it in the prerelease announcement, lemme know if it doesn't work though!

@hsivonen
Copy link
Member Author

hsivonen commented Jan 3, 2018

The 1.23.0 release candidate works.

Thank you!

@hsivonen hsivonen closed this as completed Jan 3, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. P-high High priority regression-from-stable-to-beta Performance or correctness regression from stable to beta. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

10 participants