-
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
Control Flow Guard (CFG) on Windows stops working with -Copt-level=3
and without -Coverflow-checks=on
#135963
Comments
FWIW, CFG kicks back in if I also remove
|
Maybe the test that I am using (and Chromium here) is too simplistic. I guess I should try using |
Yes, the test gives expected results after inserting
So maybe everything here works as expected and we can just go ahead and close this issue? Sorry for the noise :-/ |
@anforowicz Thank you for opening an issue when you determined there might be a problem! I cannot count (literally) how many issue reports have been lost entirely because someone waits until they are absolutely 100% sure that the issue is in the compiler, and not merely until after they've done a reasonable review, instead of a perfect one. But yes, it does seem to just be an optimization problem: sometimes the code you expect to see "run" doesn't get evaluated by the CPU, but by the abstract machine. Closing as expected behavior. |
Expected behavior: Control Flow Guard (CFG) works regardless of whether
-Copt-level=3
and/or-Coverflow-checks=on
are presentActual behavior: CFG stops working with
-Copt-level=3
and without-Coverflow-checks=on
- see step 3 belowRepro steps:
Setup: get a Windows machine + install Rust via
rustup
Check compiler version:
Prepare the following source code that should trigger a Control Flow Guard:
Contents of `cfgtest.rs`
Compile without using
-Coverflow-checks=on
, but with-Copt-level=3
.eprintln!("failed");
Compile again, this time adding
-Coverflow-checks=on
.eprintln!("failed");
/cc @ajpaverd who has kindly worked on enabling CFG in #68793
PS. FWIW I've discovered this unexpected behavior when trying to remove
-Coverflow-checks=on
from Chromium build configuration in https://crrev.com/c/6176309. Removing this led to failures in Chromium's CFG tests: see https://ci.chromium.org/ui/p/chromium/bisection/test-analysis/b/4790699691081728 and https://ci.chromium.org/ui/p/chromium/builders/ci/win-rel-cft/7593/overview.The text was updated successfully, but these errors were encountered: