diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2024-07-22 16:42:16 +0100 |
---|---|---|
committer | Thomas Koenig <tkoenig@gcc.gnu.org> | 2024-07-28 19:05:44 +0200 |
commit | 082e0faa06b32f765cceb989453d7736ddaee878 (patch) | |
tree | 8f53470dba087dc951f61280ee0d2ba36d73f974 /gcc | |
parent | 59041534f03903e828d4ada1b879af2dd1b536fb (diff) | |
download | gcc-082e0faa06b32f765cceb989453d7736ddaee878.zip gcc-082e0faa06b32f765cceb989453d7736ddaee878.tar.gz gcc-082e0faa06b32f765cceb989453d7736ddaee878.tar.bz2 |
rtl-ssa: Avoid using a stale splay tree root [PR116009]
In the fix for PR115928, I'd failed to notice that "root" was used
later in the function, so needed to be updated.
gcc/
PR rtl-optimization/116009
* rtl-ssa/accesses.cc (function_info::add_def): Set the root
local variable after removing the old clobber group.
gcc/testsuite/
PR rtl-optimization/116009
* gcc.c-torture/compile/pr116009.c: New test.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rtl-ssa/accesses.cc | 3 | ||||
-rw-r--r-- | gcc/testsuite/gcc.c-torture/compile/pr116009.c | 23 |
2 files changed, 25 insertions, 1 deletions
diff --git a/gcc/rtl-ssa/accesses.cc b/gcc/rtl-ssa/accesses.cc index c77a1ff..0bba839 100644 --- a/gcc/rtl-ssa/accesses.cc +++ b/gcc/rtl-ssa/accesses.cc @@ -946,7 +946,8 @@ function_info::add_def (def_info *def) prev = split_clobber_group (group, insn); next = prev->next_def (); tree.remove_root (); - last->set_splay_root (tree.root ()); + root = tree.root (); + last->set_splay_root (root); } // COMPARISON is < 0 if DEF comes before ROOT or > 0 if DEF comes // after ROOT. diff --git a/gcc/testsuite/gcc.c-torture/compile/pr116009.c b/gcc/testsuite/gcc.c-torture/compile/pr116009.c new file mode 100644 index 0000000..6a888d4 --- /dev/null +++ b/gcc/testsuite/gcc.c-torture/compile/pr116009.c @@ -0,0 +1,23 @@ +int tt, tt1; +int y6; +void ff(void); +int ttt; +void g(int var) { + do { + int t1 = var == 45 || var == 3434; + if (tt != 0) + if (t1) + ff(); + if (tt < 0) + break; + if (t1) + ff(); + if (tt < 0) + break; + ff(); + if (tt1) + var = y6; + if (t1) + ff(); + } while(1); +} |