-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
No apparent way to build C/C++ with -O0 #11921
Comments
I did some comparisons between:
Prep
BenchmarkHardware:
Run:
Results table
Summary
|
Thank you both for the detailed breakdown and analysis.
Given the information you have provided, I support this option. Zig should pass This is a 1-line fix, plus some comments explaining the reasoning so that a future maintainer does not make the same mistake I did and put Line 4072 in a76775b
|
Zig Version
0.10.0-dev.2674+d980c6a38
Steps to Reproduce
Expected Behavior
Clang would be invoked with
-O0
.Actual Behavior
Zig interprets this as "debug" compilation mode, and always passes
-Og
.GCC originally introduced
-Og
as an intermediate between-O0
(pathologically slow) and-O1
(some optimizations which impair debugability). Clang later copied the flag, but it seems like currently it is just an alias for-O1
.We care about this because
-O1
/-Og
are significantly slower to compile than-O0
. For CI or a local development feedback cycle, we want to be able to compile as fast as possible.The potential options I can think of are:
-Og
in debug mode, since it doesn't currently do anything different than-O1
. If Clang later decides to disable some optimizations in-Og
, we can reevaluate then.-Og
in debug mode, but let-O0
override it.-O0
. Getting fast compilation feedback and being able to debug effectively are conceptually distinct modes.The text was updated successfully, but these errors were encountered: