re PR target/13750 (Ada bootstrap failure on Tru64 UNIX: b_gnat[1b].o comparison...
authorRainer Orth <ro@gcc.gnu.org>
Thu, 5 Feb 2004 21:56:38 +0000 (21:56 +0000)
committerRainer Orth <ro@gcc.gnu.org>
Thu, 5 Feb 2004 21:56:38 +0000 (21:56 +0000)
PR middle-end/13750
Revert:
2004-01-15  Geoffrey Keating  <geoffk@apple.com>
PR pch/13361
* c-typeck.c (constructor_asmspec): Delete.
(struct initializer_stack): Delete field 'asmspec'.
(start_init): Delete saving of asmspec.
(finish_init): Don't update constructor_asmspec.
* dwarf2out.c (rtl_for_decl_location): Duplicate string from tree.
* stmt.c (expand_asm): Duplicate strings from tree.
(expand_asm_operands): Likewise.
* tree.c (tree_size): Update computation of size of STRING_CST.
(make_node): Don't make STRING_CST nodes.
(build_string): Allocate string with tree node.
* tree.def (STRING_CST): Update comment.
* tree.h (TREE_STRING_POINTER): Adjust for change to STRING_CST.
(tree_string): Place contents of string in tree node.
* config/sh/sh.c (sh_handle_sp_switch_attribute): Duplicate string
from tree.

cp:
PR middle-end/13750
Revert:
2004-01-15  Geoffrey Keating  <geoffk@apple.com>
PR pch/13361
* cp/lex.c (handle_pragma_interface): Duplicate string from tree.
(handle_pragma_implementation): Likewise.

testsuite:
PR middle-end/13750
Revert:
2004-01-15  Geoffrey Keating  <geoffk@apple.com>
PR pch/13361
* testsuite/g++.dg/pch/wchar-1.C: New.
* testsuite/g++.dg/pch/wchar-1.Hs: New.

From-SVN: r77343

13 files changed:
gcc/ChangeLog
gcc/c-typeck.c
gcc/config/sh/sh.c
gcc/cp/ChangeLog
gcc/cp/lex.c
gcc/dwarf2out.c
gcc/stmt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/pch/wchar-1.C [deleted file]
gcc/testsuite/g++.dg/pch/wchar-1.Hs [deleted file]
gcc/tree.c
gcc/tree.def
gcc/tree.h

index 921b5a8e193983763bfe2045779c9af2fc24e0bc..ed731d5c92130790e8aeb7941b438242f215e776 100644 (file)
@@ -1,3 +1,25 @@
+2004-02-05  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>
+
+       PR middle-end/13750
+       Revert:
+       2004-01-15  Geoffrey Keating  <geoffk@apple.com>
+       PR pch/13361
+       * c-typeck.c (constructor_asmspec): Delete.
+       (struct initializer_stack): Delete field 'asmspec'.
+       (start_init): Delete saving of asmspec.
+       (finish_init): Don't update constructor_asmspec.
+       * dwarf2out.c (rtl_for_decl_location): Duplicate string from tree.
+       * stmt.c (expand_asm): Duplicate strings from tree.
+       (expand_asm_operands): Likewise.
+       * tree.c (tree_size): Update computation of size of STRING_CST.
+       (make_node): Don't make STRING_CST nodes.
+       (build_string): Allocate string with tree node.
+       * tree.def (STRING_CST): Update comment.
+       * tree.h (TREE_STRING_POINTER): Adjust for change to STRING_CST.
+       (tree_string): Place contents of string in tree node.
+       * config/sh/sh.c (sh_handle_sp_switch_attribute): Duplicate string
+       from tree.
+
 2004-02-05  Joseph S. Myers  <jsm@polyomino.org.uk>
 
        * diagnostic.h (DEFINE_DIAGNOSTIC_KIND): Change parameter M to
index d61e89e6455849a91980fc58886d7674cfbe0d68..95a2c3495cdc685c0b29125124a0c352b572d463 100644 (file)
@@ -4112,6 +4112,9 @@ static int require_constant_elements;
    such as (struct foo) {...}.  */
 static tree constructor_decl;
 
+/* start_init saves the ASMSPEC arg here for really_start_incremental_init.  */
+static const char *constructor_asmspec;
+
 /* Nonzero if this is an initializer for a top-level decl.  */
 static int constructor_top_level;
 
@@ -4183,6 +4186,7 @@ struct initializer_stack
 {
   struct initializer_stack *next;
   tree decl;
+  const char *asmspec;
   struct constructor_stack *constructor_stack;
   struct constructor_range_stack *constructor_range_stack;
   tree elements;
@@ -4199,12 +4203,17 @@ struct initializer_stack *initializer_stack;
 /* Prepare to parse and output the initializer for variable DECL.  */
 
 void
-start_init (tree decl, tree asmspec_tree ATTRIBUTE_UNUSED, int top_level)
+start_init (tree decl, tree asmspec_tree, int top_level)
 {
   const char *locus;
   struct initializer_stack *p = xmalloc (sizeof (struct initializer_stack));
+  const char *asmspec = 0;
+
+  if (asmspec_tree)
+    asmspec = TREE_STRING_POINTER (asmspec_tree);
 
   p->decl = constructor_decl;
+  p->asmspec = constructor_asmspec;
   p->require_constant_value = require_constant_value;
   p->require_constant_elements = require_constant_elements;
   p->constructor_stack = constructor_stack;
@@ -4218,6 +4227,7 @@ start_init (tree decl, tree asmspec_tree ATTRIBUTE_UNUSED, int top_level)
   initializer_stack = p;
 
   constructor_decl = decl;
+  constructor_asmspec = asmspec;
   constructor_designated = 0;
   constructor_top_level = top_level;
 
@@ -4274,6 +4284,7 @@ finish_init (void)
   free (spelling_base);
   
   constructor_decl = p->decl;
+  constructor_asmspec = p->asmspec;
   require_constant_value = p->require_constant_value;
   require_constant_elements = p->require_constant_elements;
   constructor_stack = p->constructor_stack;
index caebf93d62dba777a8252362480bc707fea593b4..d3c903f5e8039489fe3d73540614a43e7ef3fe9e 100644 (file)
@@ -6776,8 +6776,8 @@ sh_handle_sp_switch_attribute (tree *node, tree name, tree args,
     }
   else
     {
-      const char *s = ggc_strdup (TREE_STRING_POINTER (TREE_VALUE (args)));
-      sp_switch = gen_rtx_SYMBOL_REF (VOIDmode, s);
+      sp_switch = gen_rtx_SYMBOL_REF (VOIDmode,
+                                     TREE_STRING_POINTER (TREE_VALUE (args)));
     }
 
   return NULL_TREE;
index 636fb21bc77604dfb9b917afbc2520bc9c5be132..dc1a92d617dfd7ec08eb5022967e29c1394a2a58 100644 (file)
@@ -1,3 +1,12 @@
+2004-02-05  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>
+
+       PR middle-end/13750
+       Revert:
+       2004-01-15  Geoffrey Keating  <geoffk@apple.com>
+       PR pch/13361
+       * cp/lex.c (handle_pragma_interface): Duplicate string from tree.
+       (handle_pragma_implementation): Likewise.
+
 2004-02-05  Mark Mitchell  <mark@codesourcery.com>
 
        PR c++/13714
index 4fb45280e2eef8582dc59aedc8291839cf420fcf..ab248a434b769d72716a54681312c339781eb4c1 100644 (file)
@@ -535,7 +535,7 @@ handle_pragma_interface (cpp_reader* dfile ATTRIBUTE_UNUSED )
   else if (fname == 0)
     main_filename = lbasename (input_filename);
   else
-    main_filename = ggc_strdup (TREE_STRING_POINTER (fname));
+    main_filename = TREE_STRING_POINTER (fname);
 
   finfo = get_fileinfo (input_filename);
 
@@ -585,7 +585,7 @@ handle_pragma_implementation (cpp_reader* dfile ATTRIBUTE_UNUSED )
     }
   else
     {
-      main_filename = ggc_strdup (TREE_STRING_POINTER (fname));
+      main_filename = TREE_STRING_POINTER (fname);
       if (cpp_included (parse_in, main_filename))
        warning ("#pragma implementation for %s appears after file is included",
                 main_filename);
index 3a405ab001861bc8cb74033440a542c5045678fb..acd79c42d1e872eba626f93c1bb548efb0cbf4f2 100644 (file)
@@ -9429,8 +9429,7 @@ rtl_for_decl_location (tree decl)
                                   TREE_STRING_LENGTH (init) - 1) == 0
              && ((size_t) TREE_STRING_LENGTH (init)
                  == strlen (TREE_STRING_POINTER (init)) + 1))
-           rtl = gen_rtx_CONST_STRING (VOIDmode,
-                                       ggc_strdup (TREE_STRING_POINTER (init)));
+           rtl = gen_rtx_CONST_STRING (VOIDmode, TREE_STRING_POINTER (init));
        }
       /* If the initializer is something that we know will expand into an
         immediate RTL constant, expand it now.  Expanding anything else
index 74d76c72f5527c8da193e418a59444f996a3e241..c33cea27152cc7f44b3e40d09e1399180d8b3ad9 100644 (file)
@@ -1102,8 +1102,7 @@ expand_asm (tree string, int vol)
   if (TREE_CODE (string) == ADDR_EXPR)
     string = TREE_OPERAND (string, 0);
 
-  body = gen_rtx_ASM_INPUT (VOIDmode,
-                           ggc_strdup (TREE_STRING_POINTER (string)));
+  body = gen_rtx_ASM_INPUT (VOIDmode, TREE_STRING_POINTER (string));
 
   MEM_VOLATILE_P (body) = vol;
 
@@ -1665,7 +1664,7 @@ expand_asm_operands (tree string, tree outputs, tree inputs,
 
   body = gen_rtx_ASM_OPERANDS ((noutputs == 0 ? VOIDmode
                                : GET_MODE (output_rtx[0])),
-                              ggc_strdup (TREE_STRING_POINTER (string)),
+                              TREE_STRING_POINTER (string),
                               empty_string, 0, argvec, constraintvec,
                               locus.file, locus.line);
 
@@ -1746,8 +1745,7 @@ expand_asm_operands (tree string, tree outputs, tree inputs,
       ASM_OPERANDS_INPUT (body, i) = op;
 
       ASM_OPERANDS_INPUT_CONSTRAINT_EXP (body, i)
-       = gen_rtx_ASM_INPUT (TYPE_MODE (type), 
-                            ggc_strdup (constraints[i + noutputs]));
+       = gen_rtx_ASM_INPUT (TYPE_MODE (type), constraints[i + noutputs]);
 
       if (decl_conflicts_with_clobbers_p (val, clobbered_regs))
        clobber_conflict_found = 1;
@@ -1788,7 +1786,7 @@ expand_asm_operands (tree string, tree outputs, tree inputs,
 
   if (noutputs == 1 && nclobbers == 0)
     {
-      ASM_OPERANDS_OUTPUT_CONSTRAINT (body) = ggc_strdup (constraints[0]);
+      ASM_OPERANDS_OUTPUT_CONSTRAINT (body) = constraints[0];
       emit_insn (gen_rtx_SET (VOIDmode, output_rtx[0], body));
     }
 
@@ -1816,9 +1814,8 @@ expand_asm_operands (tree string, tree outputs, tree inputs,
                           output_rtx[i],
                           gen_rtx_ASM_OPERANDS
                           (GET_MODE (output_rtx[i]),
-                           ggc_strdup (TREE_STRING_POINTER (string)),
-                           ggc_strdup (constraints[i]),
-                           i, argvec, constraintvec,
+                           TREE_STRING_POINTER (string),
+                           constraints[i], i, argvec, constraintvec,
                            locus.file, locus.line));
 
          MEM_VOLATILE_P (SET_SRC (XVECEXP (body, 0, i))) = vol;
index 50de43ff3f2f022a1886ac2831bbceaa07bba6ce..539f5722fdc6e3f713efa331cd68865c6fc08788 100644 (file)
@@ -1,4 +1,13 @@
-2003-02-05  Giovanni Bajo  <giovannibajo@gcc.gnu.org>
+2004-02-05  Rainer Orth  <ro@TechFak.Uni-Bielefeld.DE>
+
+       PR middle-end/13750
+       Revert:
+       2004-01-15  Geoffrey Keating  <geoffk@apple.com>
+       PR pch/13361
+       * testsuite/g++.dg/pch/wchar-1.C: New.
+       * testsuite/g++.dg/pch/wchar-1.Hs: New.
+
+2004-02-05  Giovanni Bajo  <giovannibajo@gcc.gnu.org>
 
        PR c++/14008
        * g++.dg/parse/error15.C: New test.
diff --git a/gcc/testsuite/g++.dg/pch/wchar-1.C b/gcc/testsuite/g++.dg/pch/wchar-1.C
deleted file mode 100644 (file)
index 6cb5fe1..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include "wchar-1.H"
diff --git a/gcc/testsuite/g++.dg/pch/wchar-1.Hs b/gcc/testsuite/g++.dg/pch/wchar-1.Hs
deleted file mode 100644 (file)
index 431908b..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-#include <stddef.h>
-const wchar_t test_var[] = L"wide string";
index ac0da204031f89f8247a1c5999ee681339675bae..12eabd9361dc26e34853f30d25817f2f9690cfff 100644 (file)
@@ -168,8 +168,7 @@ tree_size (tree node)
        case REAL_CST:          return sizeof (struct tree_real_cst);
        case COMPLEX_CST:       return sizeof (struct tree_complex);
        case VECTOR_CST:        return sizeof (struct tree_vector);
-       case STRING_CST:
-         return sizeof (struct tree_string) + TREE_STRING_LENGTH (node);
+       case STRING_CST:        return sizeof (struct tree_string);
        default:
          return (*lang_hooks.tree_size) (code);
        }
@@ -213,8 +212,8 @@ make_node (enum tree_code code)
   struct tree_common ttmp;
 
   /* We can't allocate a TREE_VEC without knowing how many elements
-     it will have; likewise a STRING_CST without knowing the length.  */
-  if (code == TREE_VEC || code == STRING_CST)
+     it will have.  */
+  if (code == TREE_VEC)
     abort ();
 
   TREE_SET_CODE ((tree)&ttmp, code);
@@ -526,23 +525,10 @@ build_real_from_int_cst (tree type, tree i)
 tree
 build_string (int len, const char *str)
 {
-  tree s;
-  size_t length;
-  
-  length = len + sizeof (struct tree_string);
-
-#ifdef GATHER_STATISTICS
-  tree_node_counts[(int) c_kind]++;
-  tree_node_sizes[(int) c_kind] += length;
-#endif  
-
-  s = ggc_alloc_tree (length);
+  tree s = make_node (STRING_CST);
 
-  memset (s, 0, sizeof (struct tree_common));
-  TREE_SET_CODE (s, STRING_CST);
   TREE_STRING_LENGTH (s) = len;
-  memcpy ((char *) TREE_STRING_POINTER (s), str, len);
-  ((char *) TREE_STRING_POINTER (s))[len] = '\0';
+  TREE_STRING_POINTER (s) = ggc_alloc_string (str, len);
 
   return s;
 }
index 48028ee351f9d4730780c5209b5f38de9dff6e5f..78919740da33e01846035891815024e0001ca82b 100644 (file)
@@ -274,7 +274,7 @@ DEFTREECODE (COMPLEX_CST, "complex_cst", 'c', 0)
 /* Contents are in TREE_VECTOR_CST_ELTS field.  */
 DEFTREECODE (VECTOR_CST, "vector_cst", 'c', 0)     
 
-/* Contents are TREE_STRING_LENGTH and the actual contents of the string.  */
+/* Contents are TREE_STRING_LENGTH and TREE_STRING_POINTER fields.  */
 DEFTREECODE (STRING_CST, "string_cst", 'c', 0)
 
 /* Declarations.  All references to names are represented as ..._DECL
index 6c3bc7135be948df6bf0bdd3be9a14af4164d1d9..930a1e1da263ff2082d40a166ea58cb8a59a7e85 100644 (file)
@@ -707,13 +707,13 @@ struct tree_real_cst GTY(())
 
 /* In a STRING_CST */
 #define TREE_STRING_LENGTH(NODE) (STRING_CST_CHECK (NODE)->string.length)
-#define TREE_STRING_POINTER(NODE) (STRING_CST_CHECK (NODE)->string.str)
+#define TREE_STRING_POINTER(NODE) (STRING_CST_CHECK (NODE)->string.pointer)
 
 struct tree_string GTY(())
 {
   struct tree_common common;
   int length;
-  const char str[1];
+  const char *pointer;
 };
 
 /* In a COMPLEX_CST node.  */