This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix a number of ia64-hpux PCH comparison failures


A number of PCH tests were failing on ia64-hpux because two data
structures were not properly marked up to be saved and restored.
One was the list of pending external-symbol-reference directives,
which is specific to this target; the other was the label counter
for DWARF2 location lists, which is target-independent.  While I was
at it I made the external-symbol-reference logic a bit more efficient.

bootstrapped ia64-hpux, no regressions, fixes the following failures:

-FAIL: gcc.dg/pch/inline-3.c -O0 -g assembly comparison
-FAIL: gcc.dg/pch/inline-3.c  -O0  assembly comparison
-FAIL: gcc.dg/pch/inline-3.c  -O1  assembly comparison
-FAIL: gcc.dg/pch/inline-3.c  -O2  assembly comparison
-FAIL: gcc.dg/pch/inline-3.c  -O3 -fomit-frame-pointer  assembly comparison
-FAIL: gcc.dg/pch/inline-3.c  -O3 -g  assembly comparison
-FAIL: gcc.dg/pch/inline-3.c  -Os  assembly comparison
-FAIL: g++.dg/pch/static-1.C -g assembly comparison
-FAIL: g++.dg/pch/static-1.C -O2 -g assembly comparison
-FAIL: g++.dg/pch/static-1.C -O2 assembly comparison
-FAIL: g++.dg/pch/system-1.C -g assembly comparison
-FAIL: g++.dg/pch/system-1.C -O2 -g assembly comparison
-FAIL: g++.dg/pch/system-1.C -O2 assembly comparison
-FAIL: g++.dg/pch/system-2.C -g assembly comparison
-FAIL: g++.dg/pch/system-2.C -O2 -g assembly comparison
-FAIL: g++.dg/pch/system-2.C -O2 assembly comparison
-FAIL: g++.dg/pch/uninst.C -g assembly comparison

I'm going to apply this to mainline now, and retest the ia64.c change
against the 3.4 branch.  (3.4 doesn't have location lists so the
dwarf2out.c change is irrelevant there.)

zw

        * dwarf2out.c (loclabel_num): Move outside #ifdef
        DWARF2_DEBUGGING_INFO and mark with GTY(()).
        * config/ia64/ia64.c (struct extern_func_list, extern_func_head):
        Mark with GTY(()).
        (ia64_hpux_add_extern_decl): Save the decl, not the name string.
        Allocate memory with ggc_alloc.  No need to copy anything.
        (ia64_hpux_file_end): Update to match.

===================================================================
Index: dwarf2out.c
--- dwarf2out.c	18 Feb 2004 11:02:15 -0000	1.495
+++ dwarf2out.c	18 Feb 2004 23:29:19 -0000
@@ -3592,12 +3592,12 @@ static GTY(()) unsigned ranges_table_in_
 /* Whether we have location lists that need outputting */
 static GTY(()) unsigned have_location_lists;
 
+/* Unique label counter.  */
+static GTY(()) unsigned int loclabel_num;
+
 #ifdef DWARF2_DEBUGGING_INFO
 /* Record whether the function being analyzed contains inlined functions.  */
 static int current_function_has_inlines;
-
-/* Unique label counter.  */
-static unsigned int loclabel_num = 0;
 #endif
 #if 0 && defined (MIPS_DEBUGGING_INFO)
 static int comp_unit_has_inlines;
===================================================================
Index: config/ia64/ia64.c
--- config/ia64/ia64.c	18 Feb 2004 14:21:13 -0000	1.277
+++ config/ia64/ia64.c	18 Feb 2004 23:29:29 -0000
@@ -257,7 +257,7 @@ static void ia64_rwreloc_select_rtx_sect
 static unsigned int ia64_rwreloc_section_type_flags (tree, const char *, int)
      ATTRIBUTE_UNUSED;
 
-static void ia64_hpux_add_extern_decl (const char *name)
+static void ia64_hpux_add_extern_decl (tree decl)
      ATTRIBUTE_UNUSED;
 static void ia64_hpux_file_end (void)
      ATTRIBUTE_UNUSED;
@@ -4627,7 +4627,7 @@ ia64_asm_output_external (FILE *file, tr
     return;
 
   if (TARGET_HPUX_LD)
-    ia64_hpux_add_extern_decl (name);
+    ia64_hpux_add_extern_decl (decl);
   else
     {
       /* assemble_name will set TREE_SYMBOL_REFERENCED, so we must save and
@@ -8653,20 +8653,20 @@ ia64_hpux_function_arg_padding (enum mac
    We output the name if and only if TREE_SYMBOL_REFERENCED is set in
    order to avoid putting out names that are never really used.  */
 
-struct extern_func_list
+struct extern_func_list GTY(())
 {
-  struct extern_func_list *next; /* next external */
-  char *name;                    /* name of the external */
-} *extern_func_head = 0;
+  struct extern_func_list *next;
+  tree decl;
+};
+
+static GTY(()) struct extern_func_list *extern_func_head;
 
 static void
-ia64_hpux_add_extern_decl (const char *name)
+ia64_hpux_add_extern_decl (tree decl)
 {
-  struct extern_func_list *p;
+  struct extern_func_list *p = ggc_alloc (sizeof (struct extern_func_list));
 
-  p = (struct extern_func_list *) xmalloc (sizeof (struct extern_func_list));
-  p->name = xmalloc (strlen (name) + 1);
-  strcpy(p->name, name);
+  p->decl = decl;
   p->next = extern_func_head;
   extern_func_head = p;
 }
@@ -8676,29 +8676,29 @@ ia64_hpux_add_extern_decl (const char *n
 static void
 ia64_hpux_file_end (void)
 {
-  while (extern_func_head)
+  struct extern_func_list *p;
+
+  for (p = extern_func_head; p; p = p->next)
     {
-      const char *real_name;
-      tree decl;
+      tree decl = p->decl;
+      tree id = DECL_NAME (decl);
 
-      real_name = (* targetm.strip_name_encoding) (extern_func_head->name);
-      decl = maybe_get_identifier (real_name);
+      if (!id)
+	abort ();
 
-      if (!decl
-	  || (! TREE_ASM_WRITTEN (decl) && TREE_SYMBOL_REFERENCED (decl)))
+      if (!TREE_ASM_WRITTEN (decl) && TREE_SYMBOL_REFERENCED (id))
         {
-	  if (decl)
-	    TREE_ASM_WRITTEN (decl) = 1;
-	  (*targetm.asm_out.globalize_label) (asm_out_file,
-					      extern_func_head->name);
+	  const char *name = XSTR (XEXP (DECL_RTL (decl), 0), 0);
+
+	  TREE_ASM_WRITTEN (decl) = 1;
+	  (*targetm.asm_out.globalize_label) (asm_out_file, name);
 	  fputs (TYPE_ASM_OP, asm_out_file);
-	  assemble_name (asm_out_file, extern_func_head->name);
-	  putc (',', asm_out_file);
-	  fprintf (asm_out_file, TYPE_OPERAND_FMT, "function");
-	  putc ('\n', asm_out_file);
+	  assemble_name (asm_out_file, name);
+	  fprintf (asm_out_file, "," TYPE_OPERAND_FMT "\n", "function");
         }
-      extern_func_head = extern_func_head->next;
     }
+
+  extern_func_head = 0;
 }
 
 /* Rename all the TFmode libfuncs using the HPUX conventions.  */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]