From bca7138a499a88d774ada82f0401ad0981fe7572 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Thu, 15 Nov 2018 10:42:15 +0000 Subject: [PATCH] re PR tree-optimization/88030 (ICE in calc_dfs_tree, at dominance.c:458) 2018-11-15 Richard Biener PR tree-optimization/88030 * tree-complex.c (need_eh_cleanup): New global. (update_complex_assignment): Mark blocks that need EH update. (expand_complex_comparison): Likewise. (tree_lower_complex): Allocate and deallocate need_eh_cleanup, perform EH cleanup and schedule CFG cleanup if that did anything. * gcc.dg/tsan/pr88030.c: New testcase. From-SVN: r266175 --- gcc/ChangeLog | 9 +++++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/gcc.dg/tsan/pr88030.c | 14 ++++++++++++++ gcc/tree-complex.c | 15 ++++++++++++--- 4 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/tsan/pr88030.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4bf430757dc..6258974e3e5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2018-11-15 Richard Biener + + PR tree-optimization/88030 + * tree-complex.c (need_eh_cleanup): New global. + (update_complex_assignment): Mark blocks that need EH update. + (expand_complex_comparison): Likewise. + (tree_lower_complex): Allocate and deallocate need_eh_cleanup, + perform EH cleanup and schedule CFG cleanup if that did anything. + 2018-11-15 Jakub Jelinek PR rtl-optimization/88018 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3c6c47f6766..4f9dc652018 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2018-11-15 Richard Biener + + PR tree-optimization/88030 + * gcc.dg/tsan/pr88030.c: New testcase. + 2018-11-15 Jakub Jelinek PR rtl-optimization/88018 diff --git a/gcc/testsuite/gcc.dg/tsan/pr88030.c b/gcc/testsuite/gcc.dg/tsan/pr88030.c new file mode 100644 index 00000000000..0c94c7c53f9 --- /dev/null +++ b/gcc/testsuite/gcc.dg/tsan/pr88030.c @@ -0,0 +1,14 @@ +/* { dg-do compile } */ +/* { dg-options "-fsanitize=thread -fnon-call-exceptions -fexceptions" } */ + +typedef __complex__ float Value; +typedef struct { + Value a[16 / sizeof (Value)]; +} A; + +A sum(A a,A b) +{ + a.a[0]+=b.a[0]; + a.a[1]+=b.a[1]; + return a; +} diff --git a/gcc/tree-complex.c b/gcc/tree-complex.c index 4bf644f9473..2e104c9defb 100644 --- a/gcc/tree-complex.c +++ b/gcc/tree-complex.c @@ -80,6 +80,9 @@ static vec complex_ssa_name_components; non-SSA_NAME/non-invariant args that need to be replaced by SSA_NAMEs. */ static vec phis_to_revisit; +/* BBs that need EH cleanup. */ +static bitmap need_eh_cleanup; + /* Lookup UID in the complex_variable_components hashtable and return the associated tree. */ static tree @@ -701,7 +704,7 @@ update_complex_assignment (gimple_stmt_iterator *gsi, tree r, tree i) stmt = gsi_stmt (*gsi); update_stmt (stmt); if (maybe_clean_eh_stmt (stmt)) - gimple_purge_dead_eh_edges (gimple_bb (stmt)); + bitmap_set_bit (need_eh_cleanup, gimple_bb (stmt)->index); update_complex_components (gsi, gsi_stmt (*gsi), r, i); } @@ -1559,7 +1562,7 @@ expand_complex_comparison (gimple_stmt_iterator *gsi, tree ar, tree ai, update_stmt (stmt); if (maybe_clean_eh_stmt (stmt)) - gimple_purge_dead_eh_edges (gimple_bb (stmt)); + bitmap_set_bit (need_eh_cleanup, gimple_bb (stmt)->index); } /* Expand inline asm that sets some complex SSA_NAMEs. */ @@ -1773,6 +1776,8 @@ tree_lower_complex (void) class complex_propagate complex_propagate; complex_propagate.ssa_propagate (); + need_eh_cleanup = BITMAP_ALLOC (NULL); + complex_variable_components = new int_tree_htab_type (10); complex_ssa_name_components.create (2 * num_ssa_names); @@ -1818,11 +1823,15 @@ tree_lower_complex (void) gsi_commit_edge_inserts (); + unsigned todo + = gimple_purge_all_dead_eh_edges (need_eh_cleanup) ? TODO_cleanup_cfg : 0; + BITMAP_FREE (need_eh_cleanup); + delete complex_variable_components; complex_variable_components = NULL; complex_ssa_name_components.release (); complex_lattice_values.release (); - return 0; + return todo; } namespace { -- 2.30.2