From ba585b91532b5cb382f1e2d21be50e728bca1da0 Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Sat, 23 Nov 2019 11:05:31 +0100 Subject: [PATCH] re PR rtl-optimization/92610 (ICE in calc_dfs_tree, at dominance.c:458 since r270940) PR rtl-optimization/92610 * cse.c (rest_of_handle_cse2): Call cleanup_cfg (0) also if cse_cfg_altered is set, even when tem is 0. (rest_of_handle_cse_after_global_opts): Likewise. * g++.dg/opt/pr92610.C: New test. From-SVN: r278640 --- gcc/ChangeLog | 7 +++++++ gcc/cse.c | 4 ++-- gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/opt/pr92610.C | 13 +++++++++++++ 4 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 gcc/testsuite/g++.dg/opt/pr92610.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 6ed7abaa343..596db034dfe 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2019-11-23 Jakub Jelinek + + PR rtl-optimization/92610 + * cse.c (rest_of_handle_cse2): Call cleanup_cfg (0) also if + cse_cfg_altered is set, even when tem is 0. + (rest_of_handle_cse_after_global_opts): Likewise. + 2019-11-22 Jakub Jelinek PR c++/92458 diff --git a/gcc/cse.c b/gcc/cse.c index ab9b8b43431..dd4c42d8585 100644 --- a/gcc/cse.c +++ b/gcc/cse.c @@ -7701,7 +7701,7 @@ rest_of_handle_cse2 (void) cse_cfg_altered |= cleanup_cfg (CLEANUP_CFG_CHANGED); timevar_pop (TV_JUMP); } - else if (tem == 1) + else if (tem == 1 || cse_cfg_altered) cse_cfg_altered |= cleanup_cfg (0); cse_not_expected = 1; @@ -7775,7 +7775,7 @@ rest_of_handle_cse_after_global_opts (void) cse_cfg_altered |= cleanup_cfg (CLEANUP_CFG_CHANGED); timevar_pop (TV_JUMP); } - else if (tem == 1) + else if (tem == 1 || cse_cfg_altered) cse_cfg_altered |= cleanup_cfg (0); flag_cse_follow_jumps = save_cfj; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index c34573b04dc..1c8f1a00d43 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-11-23 Jakub Jelinek + + PR rtl-optimization/92610 + * g++.dg/opt/pr92610.C: New test. + 2019-11-23 Bernd Edlinger PR c++/92365 diff --git a/gcc/testsuite/g++.dg/opt/pr92610.C b/gcc/testsuite/g++.dg/opt/pr92610.C new file mode 100644 index 00000000000..bead76037b6 --- /dev/null +++ b/gcc/testsuite/g++.dg/opt/pr92610.C @@ -0,0 +1,13 @@ +// PR rtl-optimization/92610 +// { dg-do compile } +// { dg-options "-w -fdelete-dead-exceptions --param=sccvn-max-alias-queries-per-access=0 -fno-dse -fnon-call-exceptions -Os -funroll-loops -ftrapv" } + +struct C { int x; ~C () {} }; + +int +main () +{ + C *buffer = new C[42]; + buffer[-3].x = 42; + delete [] buffer; +} -- 2.30.2