]> gcc.gnu.org Git - gcc.git/commitdiff
symtab.c (symtab_node::verify_base): Verify body_removed->!definiton
authorJan Hubicka <hubicka@ucw.cz>
Tue, 17 Feb 2015 08:58:37 +0000 (09:58 +0100)
committerJan Hubicka <hubicka@gcc.gnu.org>
Tue, 17 Feb 2015 08:58:37 +0000 (08:58 +0000)
* symtab.c (symtab_node::verify_base): Verify body_removed->!definiton
* lto-cgraph.c (lto_output_varpool_node): Do not keep definition of
variables in boundary that have no inlitalizer encoded and are
not aliases.
* varasm.c (default_binds_local_p_2): External definitions do not
count as definitions here.

From-SVN: r220749

gcc/ChangeLog
gcc/lto-cgraph.c
gcc/symtab.c
gcc/varasm.c

index bbeee3fdebcdecaa9b0cd29ff94ab2daf0825068..d7fc1f4b06ac1a7e1a835fb563fc18ebcda18dbb 100644 (file)
@@ -1,3 +1,12 @@
+2015-02-16  Jan Hubicka  <hubicka@ucw.cz>
+
+       * symtab.c (symtab_node::verify_base): Verify body_removed->!definiton
+       * lto-cgraph.c (lto_output_varpool_node): Do not keep definition of
+       variables in boundary that have no inlitalizer encoded and are
+       not aliases.
+       * varasm.c (default_binds_local_p_2): External definitions do not
+       count as definitions here.
+
 2015-02-16  Jeff Law  <law@redhat.com>
 
        PR tree-optimization/64823
index c0fa47d2c25aea672f4bd10229afddc02a974415..6add7fdf3d8f1e171edf5d14edcc9f3c5f75d2ae 100644 (file)
@@ -608,12 +608,18 @@ lto_output_varpool_node (struct lto_simple_output_block *ob, varpool_node *node,
                         lto_symtab_encoder_t encoder)
 {
   bool boundary_p = !lto_symtab_encoder_in_partition_p (encoder, node);
+  bool encode_initializer_p
+        = (node->definition
+           && lto_symtab_encoder_encode_initializer_p (encoder, node));
   struct bitpack_d bp;
   int ref;
   const char *comdat;
   const char *section;
   tree group;
 
+  gcc_assert (!encode_initializer_p || node->definition);
+  gcc_assert (boundary_p || encode_initializer_p);
+
   streamer_write_enum (ob->main_stream, LTO_symtab_tags, LTO_symtab_last_tag,
                       LTO_symtab_variable);
   streamer_write_hwi_stream (ob->main_stream, node->order);
@@ -624,11 +630,14 @@ lto_output_varpool_node (struct lto_simple_output_block *ob, varpool_node *node,
   bp_pack_value (&bp, node->force_output, 1);
   bp_pack_value (&bp, node->forced_by_abi, 1);
   bp_pack_value (&bp, node->unique_name, 1);
-  bp_pack_value (&bp, node->body_removed
-                || !lto_symtab_encoder_encode_initializer_p (encoder, node), 1);
+  bp_pack_value (&bp,
+                node->body_removed
+                || (!encode_initializer_p && !node->alias && node->definition),
+                1);
   bp_pack_value (&bp, node->implicit_section, 1);
   bp_pack_value (&bp, node->writeonly, 1);
-  bp_pack_value (&bp, node->definition, 1);
+  bp_pack_value (&bp, node->definition && (encode_initializer_p || node->alias),
+                1);
   bp_pack_value (&bp, node->alias, 1);
   bp_pack_value (&bp, node->weakref, 1);
   bp_pack_value (&bp, node->analyzed && !boundary_p, 1);
index ee47a738508ab1ba65b20ce84d5f1110cf74150d..7a70b100da172f3aabd8db323390af986f4b73d4 100644 (file)
@@ -978,6 +978,11 @@ symtab_node::verify_base (void)
       error ("double linked list of assembler names corrupted");
       error_found = true;
     }
+  if (body_removed && definition)
+    {
+      error ("node has body_removed but is definition");
+      error_found = true;
+    }
   if (analyzed && !definition)
     {
       error ("node is analyzed byt it is not a definition");
index 74854993789130493546201e3137bc98f3309ee4..dc7cfd7acdeeb74bd83afc841af510f896ee158c 100644 (file)
@@ -6831,7 +6831,8 @@ default_binds_local_p_2 (const_tree exp, bool shlib, bool weak_dominate)
   bool defined_locally = false;
   if (symtab_node *node = symtab_node::get (exp))
     {
-      if (node->definition || node->in_other_partition)
+      if ((node->definition && !DECL_EXTERNAL (node->decl))
+         || node->in_other_partition)
        {
          defined_locally = true;
          resolved_locally = (weak_dominate && !shlib);
This page took 0.080309 seconds and 5 git commands to generate.