{"action":"created","issue":{"url":"https://api.github.com/repos/rust-lang/rust/issues/29382","labels_url":"https://api.github.com/repos/rust-lang/rust/issues/29382/labels{/name}","comments_url":"https://api.github.com/repos/rust-lang/rust/issues/29382/comments","events_url":"https://api.github.com/repos/rust-lang/rust/issues/29382/events","html_url":"https://github.com/rust-lang/rust/issues/29382","id":113417029,"number":29382,"title":"LLVM assertion: Can only indirectify direct input operands!","user":{"login":"Amanieu","id":278509,"avatar_url":"https://avatars.githubusercontent.com/u/278509?v=3","gravatar_id":"","url":"https://api.github.com/users/Amanieu","html_url":"https://github.com/Amanieu","followers_url":"https://api.github.com/users/Amanieu/followers","following_url":"https://api.github.com/users/Amanieu/following{/other_user}","gists_url":"https://api.github.com/users/Amanieu/gists{/gist_id}","starred_url":"https://api.github.com/users/Amanieu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Amanieu/subscriptions","organizations_url":"https://api.github.com/users/Amanieu/orgs","repos_url":"https://api.github.com/users/Amanieu/repos","events_url":"https://api.github.com/users/Amanieu/events{/privacy}","received_events_url":"https://api.github.com/users/Amanieu/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rust-lang/rust/labels/A-inline-assembly","name":"A-inline-assembly","color":"d7e102"},{"url":"https://api.github.com/repos/rust-lang/rust/labels/I-ICE","name":"I-ICE","color":"e10c02"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-10-26T18:11:22Z","updated_at":"2015-11-03T11:53:08Z","closed_at":null,"body":"The following code triggers an LLVM assert:\r\n\r\n```rust\r\n#![feature(asm)]\r\nunsafe fn test(x: *mut u32) {\r\n    asm!(\"\": \"=m\" (*x));\r\n}\r\n```\r\n\r\n```\r\nrustc: /buildslave/rust-buildbot/slave/nightly-dist-rustc-linux/build/src/llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp:6012: void llvm::SelectionDAGBuilder::visitInlineAsm(llvm::ImmutableCallSite): Assertion `(OpInfo.isMultipleAlternative || (OpInfo.Type == InlineAsm::isInput)) && \"Can only indirectify direct input operands!\"' failed.\r\n```\r\n\r\nOne thing of note in the LLVM output is this line:\r\n```llvm\r\n%5 = call i32 asm \"\", \"=m,~{dirflag},~{fpsr},~{flags}\"(), !dbg !199, !srcloc !201\r\n```\r\nNote that the operand to the asm is left empty for some reason, which is probably wrong."},"comment":{"url":"https://api.github.com/repos/rust-lang/rust/issues/comments/153329687","html_url":"https://github.com/rust-lang/rust/issues/29382#issuecomment-153329687","issue_url":"https://api.github.com/repos/rust-lang/rust/issues/29382","id":153329687,"user":{"login":"Amanieu","id":278509,"avatar_url":"https://avatars.githubusercontent.com/u/278509?v=3","gravatar_id":"","url":"https://api.github.com/users/Amanieu","html_url":"https://github.com/Amanieu","followers_url":"https://api.github.com/users/Amanieu/followers","following_url":"https://api.github.com/users/Amanieu/following{/other_user}","gists_url":"https://api.github.com/users/Amanieu/gists{/gist_id}","starred_url":"https://api.github.com/users/Amanieu/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Amanieu/subscriptions","organizations_url":"https://api.github.com/users/Amanieu/orgs","repos_url":"https://api.github.com/users/Amanieu/repos","events_url":"https://api.github.com/users/Amanieu/events{/privacy}","received_events_url":"https://api.github.com/users/Amanieu/received_events","type":"User","site_admin":false},"created_at":"2015-11-03T11:53:07Z","updated_at":"2015-11-03T11:53:07Z","body":"Here is what clang generates for equivalent code, it seems to translate \"m\" and \"=m\" into \"*m\" and \"=*m\":\r\n```llvm\r\ncall void asm \"\", \"=*m\"(i32* %2) #1, !srcloc !3\r\n```\r\n\r\nUsing the =*m constraint directly from rust is difficult because type checking treats it as an output even though the parameter is an input pointer value."}}