diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2019-07-29 08:46:54 +0000 |
---|---|---|
committer | Richard Sandiford <rsandifo@gcc.gnu.org> | 2019-07-29 08:46:54 +0000 |
commit | ec8ac265ff21fb379ac072848561a91e4990c47f (patch) | |
tree | 05590c079f7410c30e47e42b0b61d229124c5895 /gcc/tree-cfg.c | |
parent | 4d706ff86ea86868615558e92407674a4f4b4af9 (diff) | |
download | gcc-ec8ac265ff21fb379ac072848561a91e4990c47f.zip gcc-ec8ac265ff21fb379ac072848561a91e4990c47f.tar.gz gcc-ec8ac265ff21fb379ac072848561a91e4990c47f.tar.bz2 |
Prevent -Og from deleting stores to write-only variables
This patch prevents -Og from deleting stores to write-only variables,
so that the values are still available when debugging. This seems
more convenient than forcing users to use __attribute__((used))
(probably conditionally, if it's not something they want in release
builds).
2019-07-29 Richard Sandiford <richard.sandiford@arm.com>
gcc/
* tree-cfg.c (execute_fixup_cfg): Don't delete stores to write-only
variables for -Og.
gcc/testsuite/
* c-c++-common/guality/Og-static-wo-1.c: New test.
* g++.dg/guality/guality.exp: Separate the c-c++-common tests into
"Og" and "general" tests. Run the latter at -O0 and -Og only.
* gcc.dg/guality/guality.exp: Likewise.
From-SVN: r273870
Diffstat (limited to 'gcc/tree-cfg.c')
-rw-r--r-- | gcc/tree-cfg.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/tree-cfg.c b/gcc/tree-cfg.c index 54ee63a..2648663 100644 --- a/gcc/tree-cfg.c +++ b/gcc/tree-cfg.c @@ -9579,7 +9579,8 @@ execute_fixup_cfg (void) Keep access when store has side effect, i.e. in case when source is volatile. */ if (gimple_store_p (stmt) - && !gimple_has_side_effects (stmt)) + && !gimple_has_side_effects (stmt) + && !optimize_debug) { tree lhs = get_base_address (gimple_get_lhs (stmt)); |