-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Affirm -Cforce-frame-pointers=off
does not override
#140774
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
base: master
Are you sure you want to change the base?
Affirm -Cforce-frame-pointers=off
does not override
#140774
Conversation
This comment has been minimized.
This comment has been minimized.
The current behavior of being a ratchet makes most sense to me. Enabling force-frame-pointers forces frame pointers to be used, disabling it is equivalent to not passing it at all and causes the default to be used. This matches the behavior of force-unwind-tables (for which the current behavior is required. disabling unwind tables when they are enabled by default is unsound and picking the target default even when force-unwind-tables is enabled makes the cli option useless) |
I agree and think the naming conveys this as well. The absence of force should not force the opposite, it just leaves it up to the compiler to choose. In fact, this is already clearly documented: https://doc.rust-lang.org/rustc/codegen-options/index.html?highlight=force-frame#force-frame-pointers
And this documentation has been there basically forever: #65136 |
Yes. This is essentially me looking for a clarification that yes, we intended to head in this direction, to make sure I have something authoritative to point to if it comes up again and help inform any near-future decisions about frame-pointer-related things. |
Discussed durint T-compiler triage on Zulip. We agree the situation with this multiple-value boolean flag is awkward. Maybe updating the documentation (comment) could alleviate this confusion. We are in favor of accepting this patch! Thanks for raising the topic. @rustbot label -I-compiler-nominated |
I guess the next step is getting someone review this - right? @workingjubilee please proceed with this work (if you need to) of feel free to ask for a review @rustbot author |
This test only makes sense if you send it back in time and run it with a now-old Rust commit, e.g. 50e0cc5 However, if you do go back that far in time, you will see it pass.
aaa10fe
to
e05c680
Compare
This comment has been minimized.
This comment has been minimized.
59c6fb8
to
4d62cab
Compare
-Cforce-frame-pointers
favor the target or CLI?-Cforce-frame-pointers
favors the target
-Cforce-frame-pointers
favors the target-Cforce-frame-pointers=off
does not override
-Cforce-frame-pointers=off
does not override-Cforce-frame-pointers=off
does not override
-Cforce-frame-pointers=off
does not override-Cforce-frame-pointers=off
does not override
Yes, I'm indecisive sometimes. r? compiler |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, one suggestion, then r=me.
#![feature(no_core, lang_items)] | ||
#![no_core] | ||
#[lang = "sized"] | ||
trait Sized {} | ||
#[lang = "copy"] | ||
trait Copy {} | ||
impl Copy for u32 {} | ||
|
||
// CHECK: define i32 @peach{{.*}}[[PEACH_ATTRS:\#[0-9]+]] { | ||
#[no_mangle] | ||
pub fn peach(x: u32) -> u32 { | ||
x | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion: maybe leave an impl comment here to say sth like
This does not use minicore to make it explicitly clear what compiler flags are involved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nah actually it just doesn't use minicore because I was lazy when updating this test
@rustbot author |
Update this time-traveler on the changes in compiletest and target specs that they missed over the pass ~3 years by being caught in a time rift. The aarch64-apple rev splits into itself and aarch64-apple-on, because rustc obtained support for non-leaf frame-pointers ever since 9b67cba implemented them and used them in aarch64-apple-darwin's spec. Note that the aarch64-apple-off revision fails, despite modernization. This is because 9b67cba also changed the behavior of rustc to defer to the spec over the command-line interface.
4d62cab
to
e57b4b1
Compare
This PR exists to document that we (that is, the compiler reviewer) implicitly made a decision in #86652 that defies the expectations of some programmers. Some programmers believe
-Cforce-frame-pointers=false
should obey the programmer in all cases, forcing the compiler to avoid generating frame pointers, even if the target specification would indicate they must be generated. However, many targets rely on frame pointers for fast or sound unwinding.T-compiler had a weekly triage meeting on 2025-05-22. This topic was put to discussion because some programmers may expect the target-overriding behavior. In that meeting we decided removing frame pointers, at least with regards to the contract of the
-Cforce-frame-pointers
option, is not required, even if=off
is passed, and that we will not do so if the target would expect them. This follows from the documentation here: https://doc.rust-lang.org/rustc/codegen-options/index.html#force-frame-pointersWe may separately pursue trying to clarify the situation more emphatically in our documentation, or warn when people pass the option when it doesn't do anything.