]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - gcc/varpool.c
PR fortran/95090 - ICE: identifier overflow
[thirdparty/gcc.git] / gcc / varpool.c
index 8e5a93726565550b7a2c064861898e01d51ee685..458cdf1bf376d54ce441f9f79a934d35cc2b3fdd 100644 (file)
@@ -1,5 +1,5 @@
 /* Callgraph handling code.
-   Copyright (C) 2003-2019 Free Software Foundation, Inc.
+   Copyright (C) 2003-2020 Free Software Foundation, Inc.
    Contributed by Jan Hubicka
 
 This file is part of GCC.
@@ -133,10 +133,8 @@ symbol_table::call_varpool_insertion_hooks (varpool_node *node)
 
 varpool_node *
 varpool_node::create_empty (void)
-{   
-  varpool_node *node = ggc_cleared_alloc<varpool_node> ();
-  node->type = SYMTAB_VARIABLE;
-  return node;
+{
+  return new (ggc_alloc<varpool_node> ()) varpool_node ();
 }   
 
 /* Return varpool node assigned to DECL.  Create new one when needed.  */
@@ -204,7 +202,7 @@ varpool_node::remove_initializer (void)
       && debug_info_level == DINFO_LEVEL_NONE
       /* When doing declaration merging we have duplicate
         entries for given decl.  Do not attempt to remove
-        the boides, or we will end up remiving
+        the bodies, or we will end up removing
         wrong one.  */
       && symtab->state != LTO_STREAMING)
     DECL_INITIAL (decl) = error_mark_node;
@@ -299,11 +297,12 @@ varpool_node::get_constructor (void)
         = lto_get_function_in_decl_state (file_data, decl);
 
   data = lto_get_section_data (file_data, LTO_section_function_body,
-                              name, &len, decl_state->compressed);
+                              name, order - file_data->order_base,
+                              &len, decl_state->compressed);
   if (!data)
-    fatal_error (input_location, "%s: section %s is missing",
+    fatal_error (input_location, "%s: section %s.%d is missing",
                 file_data->file_name,
-                name);
+                name, order - file_data->order_base);
 
   if (!quiet_flag)
     fprintf (stderr, " in:%s", IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)));
@@ -353,9 +352,10 @@ varpool_node::ctor_useable_for_folding_p (void)
       return DECL_INITIAL (real_node->decl) != NULL;
     }
 
-  /* Alias of readonly variable is also readonly, since the variable is stored
-     in readonly memory.  We also accept readonly aliases of non-readonly
-     locations assuming that user knows what he is asking for.  */
+  /* An alias of a read-only variable is also read-only, since the variable
+     is stored in read-only memory.  We also accept read-only aliases of
+     non-read-only locations assuming that the user knows what he is asking
+     for.  */
   if (!TREE_READONLY (decl) && !TREE_READONLY (real_node->decl))
     return false;
 
@@ -364,7 +364,7 @@ varpool_node::ctor_useable_for_folding_p (void)
      overridden at link or run time.
 
      It is actually requirement for C++ compiler to optimize const variables
-     consistently. As a GNU extension, do not enfore this rule for user defined
+     consistently. As a GNU extension, do not enforce this rule for user defined
      weak variables, so we support interposition on:
      static const int dummy = 0;
      extern const int foo __attribute__((__weak__, __alias__("dummy"))); 
@@ -408,7 +408,7 @@ ctor_for_folding (tree decl)
     return error_mark_node;
 
   /* Do not care about automatic variables.  Those are never initialized
-     anyway, because gimplifier exapnds the code.  */
+     anyway, because gimplifier expands the code.  */
   if (!TREE_STATIC (decl) && !DECL_EXTERNAL (decl))
     {
       gcc_assert (!TREE_PUBLIC (decl));
@@ -539,7 +539,10 @@ varpool_node::assemble_aliases (void)
   FOR_EACH_ALIAS (this, ref)
     {
       varpool_node *alias = dyn_cast <varpool_node *> (ref->referring);
-      if (!alias->transparent_alias)
+      if (alias->symver)
+       do_assemble_symver (alias->decl,
+                           DECL_ASSEMBLER_NAME (decl));
+      else if (!alias->transparent_alias)
        do_assemble_alias (alias->decl,
                           DECL_ASSEMBLER_NAME (decl));
       alias->assemble_aliases ();
@@ -551,7 +554,7 @@ varpool_node::assemble_aliases (void)
 bool
 varpool_node::assemble_decl (void)
 {
-  /* Aliases are outout when their target is produced or by
+  /* Aliases are output when their target is produced or by
      output_weakrefs.  */
   if (alias)
     return false;
@@ -637,7 +640,7 @@ symbol_table::remove_unreferenced_decls (void)
        {
          enqueue_node (node, &first);
          if (dump_file)
-           fprintf (dump_file, " %s", node->asm_name ());
+           fprintf (dump_file, " %s", node->dump_asm_name ());
        }
     }
   while (first != (varpool_node *)(void *)1)
@@ -685,7 +688,7 @@ symbol_table::remove_unreferenced_decls (void)
       if (!node->aux && !node->no_reorder)
        {
          if (dump_file)
-           fprintf (dump_file, " %s", node->asm_name ());
+           fprintf (dump_file, " %s", node->dump_asm_name ());
          if (referenced.contains(node))
            node->remove_initializer ();
          else
@@ -789,8 +792,8 @@ varpool_node::create_extra_name_alias (tree alias, tree decl)
   alias_node = varpool_node::create_alias (alias, decl);
   alias_node->cpp_implicit_alias = true;
 
-  /* Extra name alias mechanizm creates aliases really late
-     via DECL_ASSEMBLER_NAME mechanizm.
+  /* Extra name alias mechanism creates aliases really late
+     via DECL_ASSEMBLER_NAME mechanism.
      This is unfortunate because they are not going through the
      standard channels.  Ensure they get output.  */
   if (symtab->cpp_implicit_aliases_done)