From 27e2bd9f396088dc3642eb7d85eb424cc402c059 Mon Sep 17 00:00:00 2001 From: Richard Biener Date: Thu, 3 Sep 2015 09:24:51 +0000 Subject: [PATCH] re PR ipa/66705 (section is missing linker error with -flto -fipa-pta) 2015-09-03 Richard Biener PR ipa/66705 * tree-ssa-structalias.c (ctor_for_analysis): New function. (create_variable_info_for_1): Use ctor_for_analysis instead of get_constructor. (create_variable_info_for): Likewise. * g++.dg/lto/pr66705_0.C: New testcase. From-SVN: r227430 --- gcc/ChangeLog | 8 ++++++++ gcc/testsuite/ChangeLog | 5 +++++ gcc/testsuite/g++.dg/lto/pr66705_0.C | 15 +++++++++++++++ gcc/tree-ssa-structalias.c | 15 ++++++--------- 4 files changed, 34 insertions(+), 9 deletions(-) create mode 100644 gcc/testsuite/g++.dg/lto/pr66705_0.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 77fb2c11084..f20e551f5ed 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2015-09-03 Richard Biener + + PR ipa/66705 + * tree-ssa-structalias.c (ctor_for_analysis): New function. + (create_variable_info_for_1): Use ctor_for_analysis instead + of get_constructor. + (create_variable_info_for): Likewise. + 2015-09-02 Charles Baylis * cgraphunit.c (cgraph_node::create_wrapper): Set can_throw_external diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 2c84f9a684b..97bdd7a10ea 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2015-09-03 Richard Biener + + PR ipa/66705 + * g++.dg/lto/pr66705_0.C: New testcase. + 2015-09-02 Balaji V. Iyer PR middle-end/60586 diff --git a/gcc/testsuite/g++.dg/lto/pr66705_0.C b/gcc/testsuite/g++.dg/lto/pr66705_0.C new file mode 100644 index 00000000000..faf3f2d24c4 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/pr66705_0.C @@ -0,0 +1,15 @@ +// { dg-lto-do link } +// { dg-lto-options { { -O2 -flto -flto-partition=max -fipa-pta } } } +// { dg-extra-ld-options "-r -nostdlib" } + +class A { +public: + A(); +}; +int a = 0; +void foo() { + a = 0; + A b; + for (; a;) + ; +} diff --git a/gcc/tree-ssa-structalias.c b/gcc/tree-ssa-structalias.c index 44979193ca9..5800f8c5739 100644 --- a/gcc/tree-ssa-structalias.c +++ b/gcc/tree-ssa-structalias.c @@ -5619,7 +5619,6 @@ create_variable_info_for_1 (tree decl, const char *name) auto_vec fieldstack; fieldoff_s *fo; unsigned int i; - varpool_node *vnode; if (!declsize || !tree_fits_uhwi_p (declsize)) @@ -5637,12 +5636,10 @@ create_variable_info_for_1 (tree decl, const char *name) /* Collect field information. */ if (use_field_sensitive && var_can_have_subvars (decl) - /* ??? Force us to not use subfields for global initializers - in IPA mode. Else we'd have to parse arbitrary initializers. */ + /* ??? Force us to not use subfields for globals in IPA mode. + Else we'd have to parse arbitrary initializers. */ && !(in_ipa_mode - && is_global_var (decl) - && (vnode = varpool_node::get (decl)) - && vnode->get_constructor ())) + && is_global_var (decl))) { fieldoff_s *fo = NULL; bool notokay = false; @@ -5774,13 +5771,13 @@ create_variable_info_for (tree decl, const char *name) /* If this is a global variable with an initializer and we are in IPA mode generate constraints for it. */ - if (vnode->get_constructor () - && vnode->definition) + ipa_ref *ref; + for (unsigned idx = 0; vnode->iterate_reference (idx, ref); ++idx) { auto_vec rhsc; struct constraint_expr lhs, *rhsp; unsigned i; - get_constraint_for_rhs (vnode->get_constructor (), &rhsc); + get_constraint_for_address_of (ref->referred->decl, &rhsc); lhs.var = vi->id; lhs.offset = 0; lhs.type = SCALAR; -- 2.30.2