compilers/gnu: set level 0 optimization to '-O0'#9287
compilers/gnu: set level 0 optimization to '-O0'#9287jpakkane merged 1 commit intomesonbuild:masterfrom
Conversation
GCC with optimization set to 0 does not actually result in no optimizations, which can be annoying when trying to use a debugger like gdb, and finding that your variable has been optimized out. We already do this with clang, so gcc is a bit of an outlier here.
Codecov Report
@@ Coverage Diff @@
## master #9287 +/- ##
==========================================
+ Coverage 66.85% 69.97% +3.12%
==========================================
Files 386 193 -193
Lines 85062 42593 -42469
Branches 17551 8788 -8763
==========================================
- Hits 56869 29806 -27063
+ Misses 23401 10348 -13053
+ Partials 4792 2439 -2353
Continue to review full report at Codecov.
|
|
So which optimization level is the "don't do anything" option now? (Thinking of e.g. --buildtype=plain here....) From the GCC manpage: Is the manpage lying? |
|
I see a difference with gcc 10.3 on nixos, possibly they're patching things? Which seems likely since they're also setting -D_FORTIFY_SOURCE, which requires at least some optimizations |
|
Still, it seems better to explicitly set the value than depend on it being implicitly set, especially when in (at least one case) not setting results in not -O0 |
|
If memory serves we did use to use |
|
I can't find that, all I could find is that when we split the buildtypes into debug and optimization this silently disapeared. The combined options had |
mesonbuild#9287 changed the `optimization=0` to pass `-O0` to the compiler. This change is reasonable by itself but unfortunately, it breaks `buildtype=plain`, which promises that “no extra build flags are used”. `buildtype=plain` is important for distros like NixOS, which manage compiler flags for optimization and hardening themselves. Let’s introduce a new optimization level that does nothing and set it as the default for `buildtype=plain`.
mesonbuild#9287 changed the `optimization=0` to pass `-O0` to the compiler. This change is reasonable by itself but unfortunately, it breaks `buildtype=plain`, which promises that “no extra build flags are used”. `buildtype=plain` is important for distros like NixOS, which manage compiler flags for optimization and hardening themselves. Let’s introduce a new optimization level that does nothing and set it as the default for `buildtype=plain`.
mesonbuild#9287 changed the `optimization=0` to pass `-O0` to the compiler. This change is reasonable by itself but unfortunately, it breaks `buildtype=plain`, which promises that “no extra build flags are used”. `buildtype=plain` is important for distros like NixOS, which manage compiler flags for optimization and hardening themselves. Let’s introduce a new optimization level that does nothing and set it as the default for `buildtype=plain`.
mesonbuild#9287 changed the `optimization=0` to pass `-O0` to the compiler. This change is reasonable by itself but unfortunately, it breaks `buildtype=plain`, which promises that “no extra build flags are used”. `buildtype=plain` is important for distros like NixOS, which manage compiler flags for optimization and hardening themselves. Let’s introduce a new optimization level that does nothing and set it as the default for `buildtype=plain`.
mesonbuild#9287 changed the `optimization=0` to pass `-O0` to the compiler. This change is reasonable by itself but unfortunately, it breaks `buildtype=plain`, which promises that “no extra build flags are used”. `buildtype=plain` is important for distros like NixOS, which manage compiler flags for optimization and hardening themselves. Let’s introduce a new optimization level that does nothing and set it as the default for `buildtype=plain`.
mesonbuild#9287 changed the `optimization=0` to pass `-O0` to the compiler. This change is reasonable by itself but unfortunately, it breaks `buildtype=plain`, which promises that “no extra build flags are used”. `buildtype=plain` is important for distros like NixOS, which manage compiler flags for optimization and hardening themselves. Let’s introduce a new optimization level that does nothing and set it as the default for `buildtype=plain`.
#9287 changed the `optimization=0` to pass `-O0` to the compiler. This change is reasonable by itself but unfortunately, it breaks `buildtype=plain`, which promises that “no extra build flags are used”. `buildtype=plain` is important for distros like NixOS, which manage compiler flags for optimization and hardening themselves. Let’s introduce a new optimization level that does nothing and set it as the default for `buildtype=plain`.
GCC with optimization set to 0 does not actually result in no
optimizations, which can be annoying when trying to use a debugger like
gdb, and finding that your variable has been optimized out. We already
do this with clang, so gcc is a bit of an outlier here.