-
Notifications
You must be signed in to change notification settings - Fork 13.2k
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
rustc emits different binary code when enabling debuginfo=2 at opt-level=0,2,3 #92737
Comments
@rustbot label: +A-debuginfo +T-compiler +A-codegen |
Variables are spilled to the stack for debuginfo:
|
Indeed, this is expected, and I'm pretty sure we don't really have a feasible way forward in changing the implementation here to be different in anyway. If you need a reproducible Closing as inactionable. |
Thank you for taking a look at this issue. Both GCC and LLVM try to make such a compilation consistency wrt debug info. We have found several bugs in GCC which are already fixed, and some bugs in LLVM, which are confirmed for now. The rational behind this issue is that if a developer wants to debug a binary which has no debug info, then the developer can recompile the program with debug info, and the compiler, e.g., gcc or llvm, guarantees that the binary code will be the same. Since rustc currently does not support this guarantee, we will stop testing rustc. Thank you for your time. |
I knew GCC does this. I didn't know LLVM does too. I agree it would be nice if rustc has the same guarantee, but this isn't the case currently. There is an open issue to use |
A possibly good idea would be to submit a MCP or RFC to establish a need for such guarantee. I feel once the developers come to a consensus it is a good idea to guarantee this kind of property, then they are much more likely to implement the support necessary on the rustc side as well as petition for the fixes necessary on the LLVM side. |
I tried this compiling this code (
mutant_224.rs
) with and without debug info:I expected to see this happen: I expected the .text sections to be same when compiling with and without debug info
Instead, this happened: the .text sections are different. See below on how to recreate the difference.
opt-level=3
opt-level=2
opt-level=0
diff.txt
Meta
rustc --version --verbose
:This behaviour also exists in the nightly version:
The text was updated successfully, but these errors were encountered: