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

Option<f64>::Some behaves incorrectly in 64-bit host #9730

Closed
lifthrasiir opened this issue Oct 5, 2013 · 1 comment
Closed

Option<f64>::Some behaves incorrectly in 64-bit host #9730

lifthrasiir opened this issue Oct 5, 2013 · 1 comment

Comments

@lifthrasiir
Copy link
Contributor

Minimal example:

fn f() { assert!(false); }
struct A(f64);
struct B { x: Option<A> }
fn main() { let mut t = B { x: None }; t.x = Some(A(100.0)); println(fmt!("%?", t.x)); }

This should print Some(A(100f64)), but in 64-bit host (to be exact, x86_64-unknown-linux-gnu) this results in Some(A(0f64)) and behaves like that. Confirmed in 0.8 and (AFAIK) pre-0.9.

Notes:

  • The function f is nothing to do with the example, but it somehow prohibits the inlining of Some().
  • Only f64 triggers this bug. f32 or i64 does not.
  • Only tuple-like struct exhibits this bug. struct A { y: f64 } or enum A { A(f64) } does not, and the latter can be used a workaround for this bug.

It bears some resemblance with #9719 but the connection is unclear.

@lifthrasiir
Copy link
Contributor Author

Ugh, it seems to be fixed in the master (I had mistaken pre-0.8 master results as pre-0.9 ones), and the current master does not have this problem. Sorry for mistake.

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

No branches or pull requests

1 participant