{"action":"closed","issue":{"url":"https://api.github.com/repos/solson/miri/issues/181","repository_url":"https://api.github.com/repos/solson/miri","labels_url":"https://api.github.com/repos/solson/miri/issues/181/labels{/name}","comments_url":"https://api.github.com/repos/solson/miri/issues/181/comments","events_url":"https://api.github.com/repos/solson/miri/issues/181/events","html_url":"https://github.com/solson/miri/issues/181","id":233433670,"node_id":"MDU6SXNzdWUyMzM0MzM2NzA=","number":181,"title":"atomic_xadd::<f64> fails with rustc, succeeds with miri","user":{"login":"dwrensha","id":495768,"node_id":"MDQ6VXNlcjQ5NTc2OA==","avatar_url":"https://avatars0.githubusercontent.com/u/495768?v=4","gravatar_id":"","url":"https://api.github.com/users/dwrensha","html_url":"https://github.com/dwrensha","followers_url":"https://api.github.com/users/dwrensha/followers","following_url":"https://api.github.com/users/dwrensha/following{/other_user}","gists_url":"https://api.github.com/users/dwrensha/gists{/gist_id}","starred_url":"https://api.github.com/users/dwrensha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dwrensha/subscriptions","organizations_url":"https://api.github.com/users/dwrensha/orgs","repos_url":"https://api.github.com/users/dwrensha/repos","events_url":"https://api.github.com/users/dwrensha/events{/privacy}","received_events_url":"https://api.github.com/users/dwrensha/received_events","type":"User","site_admin":false},"labels":[{"id":285997299,"node_id":"MDU6TGFiZWwyODU5OTcyOTk=","url":"https://api.github.com/repos/solson/miri/labels/bug","name":"bug","color":"fc2929","default":true}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2017-06-04T13:29:45Z","updated_at":"2018-10-31T12:02:38Z","closed_at":"2018-10-31T12:02:38Z","author_association":"CONTRIBUTOR","body":"Consider the following program:\r\n\r\n```rust\r\n// test.rs\r\n\r\n#![feature(core_intrinsics)]\r\n\r\npub fn main() {\r\n    let mut z: f64 = 1.0;\r\n    unsafe {\r\n        ::std::intrinsics::atomic_xadd(&mut z, 2.0);\r\n    }\r\n}\r\n```\r\n\r\nWhen I try to run `test.rs` with `rustc`, I get a monomorphization error:\r\n\r\n```\r\n$ rustc test.rs\r\nerror[E0511]: invalid monomorphization of `atomic_xadd` intrinsic: expected basic integer type, found `f64`\r\n --> test.rs:8:9\r\n  |\r\n8 |         ::std::intrinsics::atomic_xadd(&mut z, 2.0);\r\n  |         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\r\n\r\nerror: aborting due to previous error(s)\r\n```\r\n\r\nHowever, when I run `test.rs` with `miri`, I expect to see a similar error, but instead the program finishes successfully:\r\n\r\n```\r\n$ cargo run --bin miri -- test.rs \r\n    Finished dev [unoptimized + debuginfo] target(s) in 0.0 secs\r\n     Running `target/debug/miri test.rs`\r\n```\r\n\r\n\r\nA possible solution might be to add some typechecking in [intrinsic.rs](https://github.com/solson/miri/blob/14848b3badb64bf0c9eab43eb87ce07d61f8a4d2/src/terminator/intrinsic.rs#L118) to match the logic in [rustc_trans::intrinsic](https://github.com/rust-lang/rust/blob/0b17b4c0846d0e01544e90bb2aa2776576e825d1/src/librustc_trans/intrinsic.rs#L414-L417).\r\n\r\nIt would be even better if rustc could somehow catch these errors during typechecking, so that miri could inherit the error handling."}}
{"actor":{"display_login":"RalfJung"}}