re PR rtl-optimization/92610 (ICE in calc_dfs_tree, at dominance.c:458 since r270940)
authorJakub Jelinek <jakub@redhat.com>
Sat, 23 Nov 2019 10:05:31 +0000 (11:05 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Sat, 23 Nov 2019 10:05:31 +0000 (11:05 +0100)
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
gcc/cse.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/opt/pr92610.C [new file with mode: 0644]

index 6ed7aba..596db03 100644 (file)
@@ -1,3 +1,10 @@
+2019-11-23  Jakub Jelinek  <jakub@redhat.com>
+
+       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  <jakub@redhat.com>
 
        PR c++/92458
index ab9b8b4..dd4c42d 100644 (file)
--- 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;
index c34573b..1c8f1a0 100644 (file)
@@ -1,3 +1,8 @@
+2019-11-23  Jakub Jelinek  <jakub@redhat.com>
+
+       PR rtl-optimization/92610
+       * g++.dg/opt/pr92610.C: New test.
+
 2019-11-23  Bernd Edlinger  <bernd.edlinger@hotmail.de>
 
        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 (file)
index 0000000..bead760
--- /dev/null
@@ -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;
+}