From 0ce4024a35d3807931eaa7328308dbb45b7f65e7 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Fri, 20 Jan 2017 10:45:04 +0100 Subject: [PATCH] Do not declare artificial variables in tree-profile.c to have a definition (PR lto/69188). 2017-01-20 Martin Liska PR lto/69188 * gcc.dg/lto/pr69188_0.c: New test. * gcc.dg/lto/pr69188_1.c: New test. 2017-01-20 Martin Liska PR lto/69188 * tree-profile.c (init_ic_make_global_vars): Do not call finalize_decl. (gimple_init_gcov_profiler): Likewise. From-SVN: r244692 --- gcc/ChangeLog | 7 +++++++ gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/gcc.dg/lto/pr69188_0.c | 7 +++++++ gcc/testsuite/gcc.dg/lto/pr69188_1.c | 10 ++++++++++ gcc/tree-profile.c | 6 ------ 5 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 gcc/testsuite/gcc.dg/lto/pr69188_0.c create mode 100644 gcc/testsuite/gcc.dg/lto/pr69188_1.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9ff10e0c34e..b5bb07590ea 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2017-01-20 Martin Liska + + PR lto/69188 + * tree-profile.c (init_ic_make_global_vars): Do not call + finalize_decl. + (gimple_init_gcov_profiler): Likewise. + 2017-01-20 Martin Liska PR ipa/71190 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index bbfd1338a1f..14ca4e90064 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2017-01-20 Martin Liska + + PR lto/69188 + * gcc.dg/lto/pr69188_0.c: New test. + * gcc.dg/lto/pr69188_1.c: New test. + 2017-01-20 Andrew Senkevich * gcc.target/i386/avx512bw-kshiftld-1.c: New test. diff --git a/gcc/testsuite/gcc.dg/lto/pr69188_0.c b/gcc/testsuite/gcc.dg/lto/pr69188_0.c new file mode 100644 index 00000000000..8bee874a65b --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr69188_0.c @@ -0,0 +1,7 @@ +/* PR ipa/69188 */ +/* { dg-lto-do link } */ +/* { dg-lto-options { { -flto -O0 -fprofile-generate } } } */ + +void fn1(void) +{ +} diff --git a/gcc/testsuite/gcc.dg/lto/pr69188_1.c b/gcc/testsuite/gcc.dg/lto/pr69188_1.c new file mode 100644 index 00000000000..3ed9d5560c6 --- /dev/null +++ b/gcc/testsuite/gcc.dg/lto/pr69188_1.c @@ -0,0 +1,10 @@ +/* PR ipa/69188 */ +/* { dg-options "-flto -O1 -fprofile-generate" } */ + +extern void fn1(void); + +int main() { + fn1(); + return 0; +} + diff --git a/gcc/tree-profile.c b/gcc/tree-profile.c index 186cfdf7929..a49ec37f8bb 100644 --- a/gcc/tree-profile.c +++ b/gcc/tree-profile.c @@ -94,8 +94,6 @@ init_ic_make_global_vars (void) if (targetm.have_tls) set_decl_tls_model (ic_void_ptr_var, decl_default_tls_model (ic_void_ptr_var)); - varpool_node::finalize_decl (ic_void_ptr_var); - gcov_type_ptr = build_pointer_type (get_gcov_type ()); ic_gcov_type_ptr_var @@ -112,8 +110,6 @@ init_ic_make_global_vars (void) DECL_INITIAL (ic_gcov_type_ptr_var) = NULL; if (targetm.have_tls) set_decl_tls_model (ic_gcov_type_ptr_var, decl_default_tls_model (ic_gcov_type_ptr_var)); - - varpool_node::finalize_decl (ic_gcov_type_ptr_var); } /* Create the type and function decls for the interface with gcov. */ @@ -210,8 +206,6 @@ gimple_init_gcov_profiler (void) DECL_ARTIFICIAL (tree_time_profiler_counter) = 1; DECL_INITIAL (tree_time_profiler_counter) = NULL; - varpool_node::finalize_decl (tree_time_profiler_counter); - /* void (*) (gcov_type *, gcov_type) */ average_profiler_fn_type = build_function_type_list (void_type_node, -- 2.30.2