Do not declare artificial variables in tree-profile.c to have a definition (PR lto...
authorMartin Liska <mliska@suse.cz>
Fri, 20 Jan 2017 09:45:04 +0000 (10:45 +0100)
committerMartin Liska <marxin@gcc.gnu.org>
Fri, 20 Jan 2017 09:45:04 +0000 (09:45 +0000)
2017-01-20  Martin Liska  <mliska@suse.cz>

PR lto/69188
* gcc.dg/lto/pr69188_0.c: New test.
* gcc.dg/lto/pr69188_1.c: New test.
2017-01-20  Martin Liska  <mliska@suse.cz>

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
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/lto/pr69188_0.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/lto/pr69188_1.c [new file with mode: 0644]
gcc/tree-profile.c

index 9ff10e0c34e76120542d5552f2607cad70348a3f..b5bb07590ea3e03015cd2df0f501518847bd4470 100644 (file)
@@ -1,3 +1,10 @@
+2017-01-20  Martin Liska  <mliska@suse.cz>
+
+       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  <mliska@suse.cz>
 
        PR ipa/71190
index bbfd1338a1fae95378df05215242a6a030f2712a..14ca4e90064af37cff0d84a4ee3387351e1fb8dc 100644 (file)
@@ -1,3 +1,9 @@
+2017-01-20  Martin Liska  <mliska@suse.cz>
+
+       PR lto/69188
+       * gcc.dg/lto/pr69188_0.c: New test.
+       * gcc.dg/lto/pr69188_1.c: New test.
+
 2017-01-20  Andrew Senkevich  <andrew.senkevich@intel.com>
 
        * 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 (file)
index 0000000..8bee874
--- /dev/null
@@ -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 (file)
index 0000000..3ed9d55
--- /dev/null
@@ -0,0 +1,10 @@
+/* PR ipa/69188 */
+/* { dg-options "-flto -O1 -fprofile-generate" } */
+
+extern void fn1(void);
+
+int main() {
+  fn1();
+  return 0;
+}
+
index 186cfdf792938bf58d4827d57e4d2b80b463109b..a49ec37f8bbc7d3608f21e0108ded34d747501fc 100644 (file)
@@ -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,