-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Closed
Description
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 ofSome()
. - Only
f64
triggers this bug.f32
ori64
does not. - Only tuple-like struct exhibits this bug.
struct A { y: f64 }
orenum 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.
Metadata
Metadata
Assignees
Labels
No labels