We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
#[no_mangle] pub unsafe fn assign_answer(x: *mut u32) { x.read_volatile(); x.write_volatile(42); x.write_volatile(42); }
In the code generated by cg_llvm, all volatile loads and stores are preserved.
0000000000001100 <assign_answer>: 1100: 8b 07 mov (%rdi),%eax 1102: c7 07 2a 00 00 00 movl $0x2a,(%rdi) 1108: c7 07 2a 00 00 00 movl $0x2a,(%rdi) 110e: c3 ret 110f: 90 nop
In the code generated by cg_gcc, the load whose result is discarded is eliminated, and the overlapping stores are combined into one.
0000000000001100 <assign_answer>: 1100: c7 07 2a 00 00 00 movl $0x2a,(%rdi) 1106: c3 ret 1107: 66 0f 1f 84 00 00 00 nopw 0x0(%rax,%rax,1) 110e: 00 00
The text was updated successfully, but these errors were encountered:
Looks like the volatile qualification is incorrectly applied to the pointer type instead of its pointee.
rustc_codegen_gcc/src/builder.rs
Lines 671 to 675 in 1d62e95
Sorry, something went wrong.
Successfully merging a pull request may close this issue.
In the code generated by cg_llvm, all volatile loads and stores are preserved.
In the code generated by cg_gcc, the load whose result is discarded is eliminated, and the overlapping stores are combined into one.
The text was updated successfully, but these errors were encountered: