diff options
author | Jan Hubicka <hubicka@ucw.cz> | 2018-11-20 15:09:27 +0100 |
---|---|---|
committer | Jan Hubicka <hubicka@gcc.gnu.org> | 2018-11-20 14:09:27 +0000 |
commit | 375c3b863cfa30db17df0259a423ade00961c974 (patch) | |
tree | 01ea04cf57eb05dac491fd59b2b0d328f93e3a29 | |
parent | 12485662c00914ed132d950f1329fdaf32c11a3c (diff) | |
download | gcc-375c3b863cfa30db17df0259a423ade00961c974.zip gcc-375c3b863cfa30db17df0259a423ade00961c974.tar.gz gcc-375c3b863cfa30db17df0259a423ade00961c974.tar.bz2 |
re PR lto/87997 (ICE in cp_var_mod_type_p at gcc/cp/cp-objcp-common.c:107 since r265870)
PR lto/87997
* tree.c (free_lang_data_in_cgraph): Add argument fld; break out
type checking to...
(free_lang_data) ... here; update call of free_lang_data_in_cgraph.
From-SVN: r266316
-rw-r--r-- | gcc/ChangeLog | 7 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/torture/pr87997.C | 35 | ||||
-rw-r--r-- | gcc/tree.c | 36 |
3 files changed, 62 insertions, 16 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 44ca2ce..042075e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,12 @@ 2018-11-20 Jan Hubicka <hubicka@ucw.cz> + PR lto/87997 + * tree.c (free_lang_data_in_cgraph): Add argument fld; break out + type checking to... + (free_lang_data) ... here; update call of free_lang_data_in_cgraph. + +2018-11-20 Jan Hubicka <hubicka@ucw.cz> + PR ipa/87706 * ipa-fnsummary.c (pass_ipa_fnsummary): Do not remove functions * ipa.c (possible_inline_candidate_p): Break out from .. diff --git a/gcc/testsuite/g++.dg/torture/pr87997.C b/gcc/testsuite/g++.dg/torture/pr87997.C new file mode 100644 index 0000000..23e22eb --- /dev/null +++ b/gcc/testsuite/g++.dg/torture/pr87997.C @@ -0,0 +1,35 @@ +/* { dg-do compile } */ +template <typename, typename> struct a; +template <template <typename> class b, typename c, typename f, typename... d> +struct a<b<f, d...>, c> { + using e = b<c>; +}; +template <typename f> class h { +public: + typedef f g; +}; +template <typename j, typename c> using k = typename a<j, c>::e; +template <typename j> struct l { template <typename f> using m = k<j, f>; }; +template <typename j> struct n { + typedef typename j::g o; + template <typename f> struct p { + typedef typename l<j>::template m<f> other; + }; +}; +template <typename f, typename j> struct F { + typedef typename n<j>::template p<f>::other q; +}; +template <typename f, typename j = h<f>> class r { +public: + typename n<typename F<f, j>::q>::o operator[](long); + f *t() noexcept; +}; +class s { + void m_fn2(); + r<int (s::*)()> u; +}; +void s::m_fn2() try { + for (int i;;) + (this->*u[i])(); +} catch (...) { +} @@ -6021,44 +6021,38 @@ assign_assembler_name_if_needed (tree t) been set up. */ static void -free_lang_data_in_cgraph (void) +free_lang_data_in_cgraph (struct free_lang_data_d *fld) { struct cgraph_node *n; varpool_node *v; - struct free_lang_data_d fld; tree t; unsigned i; alias_pair *p; /* Find decls and types in the body of every function in the callgraph. */ FOR_EACH_FUNCTION (n) - find_decls_types_in_node (n, &fld); + find_decls_types_in_node (n, fld); FOR_EACH_VEC_SAFE_ELT (alias_pairs, i, p) - find_decls_types (p->decl, &fld); + find_decls_types (p->decl, fld); /* Find decls and types in every varpool symbol. */ FOR_EACH_VARIABLE (v) - find_decls_types_in_var (v, &fld); + find_decls_types_in_var (v, fld); /* Set the assembler name on every decl found. We need to do this now because free_lang_data_in_decl will invalidate data needed for mangling. This breaks mangling on interdependent decls. */ - FOR_EACH_VEC_ELT (fld.decls, i, t) + FOR_EACH_VEC_ELT (fld->decls, i, t) assign_assembler_name_if_needed (t); /* Traverse every decl found freeing its language data. */ - FOR_EACH_VEC_ELT (fld.decls, i, t) - free_lang_data_in_decl (t, &fld); + FOR_EACH_VEC_ELT (fld->decls, i, t) + free_lang_data_in_decl (t, fld); /* Traverse every type found freeing its language data. */ - FOR_EACH_VEC_ELT (fld.types, i, t) - free_lang_data_in_type (t, &fld); - if (flag_checking) - { - FOR_EACH_VEC_ELT (fld.types, i, t) - verify_type (t); - } + FOR_EACH_VEC_ELT (fld->types, i, t) + free_lang_data_in_type (t, fld); } @@ -6068,6 +6062,7 @@ static unsigned free_lang_data (void) { unsigned i; + struct free_lang_data_d fld; /* If we are the LTO frontend we have freed lang-specific data already. */ if (in_lto_p @@ -6088,7 +6083,7 @@ free_lang_data (void) /* Traverse the IL resetting language specific information for operands, expressions, etc. */ - free_lang_data_in_cgraph (); + free_lang_data_in_cgraph (&fld); /* Create gimple variants for common types. */ for (unsigned i = 0; @@ -6109,6 +6104,15 @@ free_lang_data (void) lang_hooks.tree_inlining.var_mod_type_p = hook_bool_tree_tree_false; + if (flag_checking) + { + int i; + tree t; + + FOR_EACH_VEC_ELT (fld.types, i, t) + verify_type (t); + } + /* We do not want the default decl_assembler_name implementation, rather if we have fixed everything we want a wrapper around it asserting that all non-local symbols already got their assembler |