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]

[PCH] bug fixes...


This fixes some bugs, the most notable of which were in the testsuite
(much of it wasn't testing PCH at all).  Well, OK, failing to restore
the string in an IDENTIFIER_NODE was pretty bad too.

Bootstrapped & tested on powerpc-darwin.

-- 
- Geoffrey Keating <geoffk@apple.com>

===File ~/patches/pchbranch-labelnum.patch==================
Index: ChangeLog
2002-11-13  Geoffrey Keating  <geoffk@apple.com>

	* Makefile.in (GTFILES): Add cpplib.h.
	* c-common.h (struct c_common_identifier): Don't skip 'node' field.
	* c-decl.c (build_compound_literal): Don't use var_labelno.
	* cpplib.h (struct cpp_hashnode): Use gengtype to mark.
	* dwarf2asm.c (dw2_force_const_mem): Don't use const_labelno.
	* varasm.c (const_labelno): Use gengtype to mark.
	(var_labelno): Likewise.
	(in_section): Likewise.
	(in_named_name): Likewise.
	(struct in_named_entry): Likewise.
	(in_named_htab): Likewise.
	(set_named_section_flags): Use GGC to allocate struct in_named_entry.
	(init_varasm_once): Use GGC to allocate in_named_htab.
	* config/darwin.c (current_pic_label_num): Mark for PCH.

Index: testsuite/ChangeLog
2002-11-13  Geoffrey Keating  <geoffk@apple.com>

	* gcc.dg/pch/pch.exp: Ensure that <test>.hp doesn't exist before
	running test.
	* gcc.dg/pch: Include *.hp not *.h.
	* gcc.dg/pch/system-1.h: New.
	* gcc.dg/pch/system-1.c: New.

Index: Makefile.in
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Makefile.in,v
retrieving revision 1.822.2.36
diff -u -p -u -p -r1.822.2.36 Makefile.in
--- Makefile.in	10 Nov 2002 07:16:41 -0000	1.822.2.36
+++ Makefile.in	14 Nov 2002 01:58:21 -0000
@@ -1838,7 +1838,7 @@ s-preds: genpreds$(build_exeext) $(srcdi
 	$(STAMP) s-preds
 
 GTFILES = $(GCONFIG_H) \
-  $(HASHTAB_H) $(SPLAY_TREE_H) \
+  $(HASHTAB_H) $(SPLAY_TREE_H) $(srcdir)/cpplib.h \
   $(srcdir)/location.h $(srcdir)/bitmap.h $(srcdir)/function.h \
   $(srcdir)/rtl.h $(srcdir)/optabs.h $(srcdir)/tree.h $(srcdir)/libfuncs.h \
   $(srcdir)/hashtable.h $(srcdir)/real.h \
Index: c-common.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-common.h,v
retrieving revision 1.112.4.20
diff -u -p -u -p -r1.112.4.20 c-common.h
--- c-common.h	10 Nov 2002 07:16:42 -0000	1.112.4.20
+++ c-common.h	14 Nov 2002 01:58:21 -0000
@@ -181,7 +181,7 @@ enum c_tree_index
 struct c_common_identifier GTY(())
 {
   struct tree_common common;
-  struct cpp_hashnode GTY ((skip (""))) node;
+  struct cpp_hashnode node;
 };
 
 #define wchar_type_node			c_global_trees[CTI_WCHAR_TYPE]
Index: c-decl.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/c-decl.c,v
retrieving revision 1.288.2.17
diff -u -p -u -p -r1.288.2.17 c-decl.c
--- c-decl.c	10 Nov 2002 07:16:42 -0000	1.288.2.17
+++ c-decl.c	14 Nov 2002 01:58:22 -0000
@@ -3211,6 +3211,8 @@ clear_parm_order ()
   current_binding_level->parm_order = NULL_TREE;
 }
 
+static GTY(()) int compound_literal_number;
+
 /* Build a COMPOUND_LITERAL_EXPR.  TYPE is the type given in the compound
    literal, which may be an incomplete array type completed by the
    initializer; INIT is a CONSTRUCTOR that initializes the compound
@@ -3258,10 +3260,10 @@ build_compound_literal (type, init)
       /* This decl needs a name for the assembler output.  We also need
 	 a unique suffix to be added to the name.  */
       char *name;
-      extern int var_labelno;
 
-      ASM_FORMAT_PRIVATE_NAME (name, "__compound_literal", var_labelno);
-      var_labelno++;
+      ASM_FORMAT_PRIVATE_NAME (name, "__compound_literal", 
+			       compound_literal_number);
+      compound_literal_number++;
       DECL_NAME (decl) = get_identifier (name);
       DECL_DEFER_OUTPUT (decl) = 1;
       DECL_COMDAT (decl) = 1;
Index: cpplib.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cpplib.h,v
retrieving revision 1.199.4.13
diff -u -p -u -p -r1.199.4.13 cpplib.h
--- cpplib.h	10 Nov 2002 07:16:50 -0000	1.199.4.13
+++ cpplib.h	14 Nov 2002 01:58:22 -0000
@@ -482,7 +482,7 @@ enum builtin_type
 /* The common part of an identifier node shared amongst all 3 C front
    ends.  Also used to store CPP identifiers, which are a superset of
    identifiers in the grammatical sense.  */
-struct cpp_hashnode
+struct cpp_hashnode GTY(())
 {
   struct ht_identifier ident;
   unsigned short arg_index;		/* Macro argument index.  */
@@ -491,13 +491,17 @@ struct cpp_hashnode
   ENUM_BITFIELD(node_type) type : 8;	/* CPP node type.  */
   unsigned char flags;			/* CPP flags.  */
 
-  union
+  union cpp_hashnode_u
   {
-    cpp_macro *macro;			/* If a macro.  */
-    struct answer *answers;		/* Answers to an assertion.  */
-    enum cpp_ttype operator;		/* Code for a named operator.  */
-    enum builtin_type builtin;		/* Code for a builtin macro.  */
-  } value;
+    /* If a macro.  */
+    cpp_macro * GTY((skip (""))) macro;
+    /* Answers to an assertion.  */
+    struct answer * GTY ((skip (""))) answers;
+    /* Code for a named operator.  */
+    enum cpp_ttype GTY ((tag ("0"))) operator;
+    /* Code for a builtin macro.  */
+    enum builtin_type GTY ((tag ("1"))) builtin; 
+  } GTY ((desc ("0"))) value;
 };
 
 /* Call this first to get a handle to pass to other functions.  */
Index: dwarf2asm.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/dwarf2asm.c,v
retrieving revision 1.24.4.5
diff -u -p -u -p -r1.24.4.5 dwarf2asm.c
--- dwarf2asm.c	25 Sep 2002 19:16:01 -0000	1.24.4.5
+++ dwarf2asm.c	14 Nov 2002 01:58:22 -0000
@@ -692,6 +692,8 @@ static int dw2_output_indirect_constant_
 
 static GTY((param1_is (char *), param2_is (tree))) splay_tree indirect_pool;
 
+static GTY(()) int dw2_const_labelno;
+
 #if defined(HAVE_GAS_HIDDEN) && defined(SUPPORTS_ONE_ONLY)
 # define USE_LINKONCE_INDIRECT 1
 #else
@@ -739,11 +741,10 @@ dw2_force_const_mem (x)
 	}
       else
 	{
-	  extern int const_labelno;
 	  char label[32];
 
-	  ASM_GENERATE_INTERNAL_LABEL (label, "LC", const_labelno);
-	  ++const_labelno;
+	  ASM_GENERATE_INTERNAL_LABEL (label, "LDFCM", dw2_const_labelno);
+	  ++dw2_const_labelno;
 	  id = get_identifier (label);
 	  decl = build_decl (VAR_DECL, id, ptr_type_node);
 	  DECL_ARTIFICIAL (decl) = 1;
Index: varasm.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/varasm.c,v
retrieving revision 1.243.2.21
diff -u -p -u -p -r1.243.2.21 varasm.c
--- varasm.c	10 Nov 2002 07:17:09 -0000	1.243.2.21
+++ varasm.c	14 Nov 2002 01:58:22 -0000
@@ -105,12 +105,12 @@ struct varasm_status GTY(())
 /* Number for making the label on the next
    constant that is stored in memory.  */
 
-int const_labelno;
+static GTY(()) int const_labelno;
 
 /* Number for making the label on the next
    static variable internal to a function.  */
 
-int var_labelno;
+static GTY(()) int var_labelno;
 
 /* Carry information from ASM_DECLARE_OBJECT_NAME
    to ASM_FINISH_DECLARE_OBJECT.  */
@@ -177,7 +177,7 @@ static bool asm_emit_uninitialised	PARAM
 static void resolve_unique_section	PARAMS ((tree, int, int));
 static void mark_weak                   PARAMS ((tree));
 
-static enum in_section { no_section, in_text, in_data, in_named
+enum in_section { no_section, in_text, in_data, in_named
 #ifdef BSS_SECTION_ASM_OP
   , in_bss
 #endif
@@ -193,7 +193,8 @@ static enum in_section { no_section, in_
 #ifdef EXTRA_SECTIONS
   , EXTRA_SECTIONS
 #endif
-} in_section = no_section;
+};
+static GTY(()) enum in_section in_section = no_section;
 
 /* Return a nonzero value if DECL has a section attribute.  */
 #ifndef IN_NAMED_SECTION
@@ -203,18 +204,18 @@ static enum in_section { no_section, in_
 #endif
 
 /* Text of section name when in_section == in_named.  */
-static const char *in_named_name;
+static GTY(()) const char *in_named_name;
 
 /* Hash table of flags that have been used for a particular named section.  */
 
-struct in_named_entry
+struct in_named_entry GTY(())
 {
   const char *name;
   unsigned int flags;
   bool declared;
 };
 
-static htab_t in_named_htab;
+static GTY((param_is (struct in_named_entry))) htab_t in_named_htab;
 
 /* Define functions like text_section for any extra sections.  */
 #ifdef EXTRA_SECTION_FUNCTIONS
@@ -387,7 +388,7 @@ set_named_section_flags (section, flags)
 
   if (!entry)
     {
-      entry = (struct in_named_entry *) xmalloc (sizeof (*entry));
+      entry = (struct in_named_entry *) ggc_alloc (sizeof (*entry));
       *slot = entry;
       entry->name = ggc_strdup (section);
       entry->flags = flags;
@@ -4721,8 +4722,8 @@ init_varasm_once ()
 {
   const_str_htab = htab_create_ggc (128, const_str_htab_hash,
 				    const_str_htab_eq, NULL);
-  in_named_htab = htab_create (31, in_named_entry_hash,
-			       in_named_entry_eq, NULL);
+  in_named_htab = htab_create_ggc (31, in_named_entry_hash,
+				   in_named_entry_eq, NULL);
 
   const_alias_set = new_alias_set ();
 }
Index: config/darwin.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/darwin.c,v
retrieving revision 1.17.6.9
diff -u -p -u -p -r1.17.6.9 darwin.c
--- config/darwin.c	10 Nov 2002 07:18:02 -0000	1.17.6.9
+++ config/darwin.c	14 Nov 2002 01:58:24 -0000
@@ -221,7 +221,7 @@ machopic_define_name (name)
 
 static char function_base[32];
 
-static int current_pic_label_num;
+static GTY(()) int current_pic_label_num;
 
 const char *
 machopic_function_base_name ()
Index: testsuite/gcc.dg/pch/common-1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/pch/Attic/common-1.c,v
retrieving revision 1.1.2.2
diff -u -p -u -p -r1.1.2.2 common-1.c
--- testsuite/gcc.dg/pch/common-1.c	11 Nov 2002 23:41:37 -0000	1.1.2.2
+++ testsuite/gcc.dg/pch/common-1.c	14 Nov 2002 01:58:36 -0000
@@ -1,3 +1,3 @@
-#include "common-1.h"
+#include "common-1.hp"
 int foo2 = 3;
 int zz = 2;
Index: testsuite/gcc.dg/pch/decl-1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/pch/Attic/decl-1.c,v
retrieving revision 1.1.2.2
diff -u -p -u -p -r1.1.2.2 decl-1.c
--- testsuite/gcc.dg/pch/decl-1.c	11 Nov 2002 23:41:37 -0000	1.1.2.2
+++ testsuite/gcc.dg/pch/decl-1.c	14 Nov 2002 01:58:36 -0000
@@ -1,2 +1,2 @@
-#include "decl-1.h"
+#include "decl-1.hp"
 int main(void) { return foo; }
Index: testsuite/gcc.dg/pch/decl-2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/pch/Attic/decl-2.c,v
retrieving revision 1.1.2.2
diff -u -p -u -p -r1.1.2.2 decl-2.c
--- testsuite/gcc.dg/pch/decl-2.c	11 Nov 2002 23:41:37 -0000	1.1.2.2
+++ testsuite/gcc.dg/pch/decl-2.c	14 Nov 2002 01:58:36 -0000
@@ -1,2 +1,2 @@
-#include "decl-2.h"
+#include "decl-2.hp"
 int main(void) { return fun (1, 2); }
Index: testsuite/gcc.dg/pch/decl-3.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/pch/Attic/decl-3.c,v
retrieving revision 1.1.2.2
diff -u -p -u -p -r1.1.2.2 decl-3.c
--- testsuite/gcc.dg/pch/decl-3.c	11 Nov 2002 23:41:37 -0000	1.1.2.2
+++ testsuite/gcc.dg/pch/decl-3.c	14 Nov 2002 01:58:36 -0000
@@ -1,4 +1,4 @@
-#include "decl-3.h"
+#include "decl-3.hp"
 
 foo_p bar (void) 
 {
Index: testsuite/gcc.dg/pch/decl-4.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/pch/Attic/decl-4.c,v
retrieving revision 1.1.2.2
diff -u -p -u -p -r1.1.2.2 decl-4.c
--- testsuite/gcc.dg/pch/decl-4.c	11 Nov 2002 23:41:37 -0000	1.1.2.2
+++ testsuite/gcc.dg/pch/decl-4.c	14 Nov 2002 01:58:36 -0000
@@ -1,4 +1,4 @@
-#include "decl-4.h"
+#include "decl-4.hp"
 
 int bar (foo_p f)
 {
Index: testsuite/gcc.dg/pch/decl-5.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/pch/Attic/decl-5.c,v
retrieving revision 1.1.2.2
diff -u -p -u -p -r1.1.2.2 decl-5.c
--- testsuite/gcc.dg/pch/decl-5.c	11 Nov 2002 23:41:37 -0000	1.1.2.2
+++ testsuite/gcc.dg/pch/decl-5.c	14 Nov 2002 01:58:36 -0000
@@ -1,2 +1,2 @@
-#include "decl-5.h"
+#include "decl-5.hp"
 static int (*t)(void) = foo;
Index: testsuite/gcc.dg/pch/global-1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/pch/Attic/global-1.c,v
retrieving revision 1.1.2.2
diff -u -p -u -p -r1.1.2.2 global-1.c
--- testsuite/gcc.dg/pch/global-1.c	11 Nov 2002 23:41:37 -0000	1.1.2.2
+++ testsuite/gcc.dg/pch/global-1.c	14 Nov 2002 01:58:36 -0000
@@ -1,2 +1,2 @@
-#include "global-1.h"
+#include "global-1.hp"
 const int bar = 3;
Index: testsuite/gcc.dg/pch/inline-1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/pch/Attic/inline-1.c,v
retrieving revision 1.1.2.2
diff -u -p -u -p -r1.1.2.2 inline-1.c
--- testsuite/gcc.dg/pch/inline-1.c	11 Nov 2002 23:41:37 -0000	1.1.2.2
+++ testsuite/gcc.dg/pch/inline-1.c	14 Nov 2002 01:58:36 -0000
@@ -1,4 +1,4 @@
-#include "inline-1.h"
+#include "inline-1.hp"
 int bar(int a, int b)
 {
   return foo(a) + b;
Index: testsuite/gcc.dg/pch/inline-2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/pch/Attic/inline-2.c,v
retrieving revision 1.1.2.2
diff -u -p -u -p -r1.1.2.2 inline-2.c
--- testsuite/gcc.dg/pch/inline-2.c	11 Nov 2002 23:41:37 -0000	1.1.2.2
+++ testsuite/gcc.dg/pch/inline-2.c	14 Nov 2002 01:58:36 -0000
@@ -1,4 +1,4 @@
-#include "inline-2.h"
+#include "inline-2.hp"
 extern inline char
 bar(int a)
 {
Index: testsuite/gcc.dg/pch/pch.exp
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/pch/Attic/pch.exp,v
retrieving revision 1.1.2.3
diff -u -p -u -p -r1.1.2.3 pch.exp
--- testsuite/gcc.dg/pch/pch.exp	11 Nov 2002 23:41:37 -0000	1.1.2.3
+++ testsuite/gcc.dg/pch/pch.exp	14 Nov 2002 01:58:36 -0000
@@ -40,6 +40,7 @@ foreach test [lsort [glob -nocomplain $s
     catch { file delete "$bname.h.pch" }
     catch { file delete "$bname.s" }
     catch { file delete "$bname.s-pch" }
+    catch { file delete "$bname.hp" }
 
     # We don't try to use the loop-optimizing options, since they are highly
     # unlikely to make any difference to PCH.
Index: testsuite/gcc.dg/pch/static-1.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/pch/Attic/static-1.c,v
retrieving revision 1.1.2.2
diff -u -p -u -p -r1.1.2.2 static-1.c
--- testsuite/gcc.dg/pch/static-1.c	11 Nov 2002 23:41:37 -0000	1.1.2.2
+++ testsuite/gcc.dg/pch/static-1.c	14 Nov 2002 01:58:36 -0000
@@ -1,4 +1,4 @@
-#include "static-1.h"
+#include "static-1.hp"
 static int bar(void)
 {
   static int counter;
Index: testsuite/gcc.dg/pch/static-2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/testsuite/gcc.dg/pch/Attic/static-2.c,v
retrieving revision 1.1.2.2
diff -u -p -u -p -r1.1.2.2 static-2.c
--- testsuite/gcc.dg/pch/static-2.c	11 Nov 2002 23:41:37 -0000	1.1.2.2
+++ testsuite/gcc.dg/pch/static-2.c	14 Nov 2002 01:58:36 -0000
@@ -1,4 +1,4 @@
-#include "static-2.h"
+#include "static-2.hp"
 int bar(void)
 {
   static int counter;
Index: testsuite/gcc.dg/pch/system-1.c
===================================================================
RCS file: testsuite/gcc.dg/pch/system-1.c
diff -N testsuite/gcc.dg/pch/system-1.c
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ testsuite/gcc.dg/pch/system-1.c	14 Nov 2002 01:58:36 -0000
@@ -0,0 +1,6 @@
+#include "system-1.hp"
+int main(void)
+{
+  puts ("hello world!");
+  exit (0);
+}
Index: testsuite/gcc.dg/pch/system-1.h
===================================================================
RCS file: testsuite/gcc.dg/pch/system-1.h
diff -N testsuite/gcc.dg/pch/system-1.h
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ testsuite/gcc.dg/pch/system-1.h	14 Nov 2002 01:58:36 -0000
@@ -0,0 +1,2 @@
+#include <stdio.h>
+#include <stdlib.h>
============================================================


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