From 839ee4bc570bf56df913d37a4fa3ab9fb6e5956e Mon Sep 17 00:00:00 2001 From: Rainer Orth Date: Thu, 5 Feb 2004 21:56:38 +0000 Subject: re PR target/13750 (Ada bootstrap failure on Tru64 UNIX: b_gnat[1b].o comparison failure) PR middle-end/13750 Revert: 2004-01-15 Geoffrey Keating 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 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 PR pch/13361 * testsuite/g++.dg/pch/wchar-1.C: New. * testsuite/g++.dg/pch/wchar-1.Hs: New. From-SVN: r77343 --- gcc/ChangeLog | 22 ++++++++++++++++++++++ gcc/c-typeck.c | 13 ++++++++++++- gcc/config/sh/sh.c | 4 ++-- gcc/cp/ChangeLog | 9 +++++++++ gcc/cp/lex.c | 4 ++-- gcc/dwarf2out.c | 3 +-- gcc/stmt.c | 15 ++++++--------- gcc/testsuite/ChangeLog | 11 ++++++++++- gcc/testsuite/g++.dg/pch/wchar-1.C | 1 - gcc/testsuite/g++.dg/pch/wchar-1.Hs | 2 -- gcc/tree.c | 24 +++++------------------- gcc/tree.def | 2 +- gcc/tree.h | 4 ++-- 13 files changed, 72 insertions(+), 42 deletions(-) delete mode 100644 gcc/testsuite/g++.dg/pch/wchar-1.C delete mode 100644 gcc/testsuite/g++.dg/pch/wchar-1.Hs diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 921b5a8..ed731d5c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,25 @@ +2004-02-05 Rainer Orth + + PR middle-end/13750 + Revert: + 2004-01-15 Geoffrey Keating + 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 * diagnostic.h (DEFINE_DIAGNOSTIC_KIND): Change parameter M to diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index d61e89e..95a2c34 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -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; diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index caebf93..d3c903f 100644 --- a/gcc/config/sh/sh.c +++ b/gcc/config/sh/sh.c @@ -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; diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 636fb21..dc1a92d 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,12 @@ +2004-02-05 Rainer Orth + + PR middle-end/13750 + Revert: + 2004-01-15 Geoffrey Keating + PR pch/13361 + * cp/lex.c (handle_pragma_interface): Duplicate string from tree. + (handle_pragma_implementation): Likewise. + 2004-02-05 Mark Mitchell PR c++/13714 diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index 4fb4528..ab248a4 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -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); diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 3a405ab..acd79c4 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -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 diff --git a/gcc/stmt.c b/gcc/stmt.c index 74d76c7..c33cea2 100644 --- a/gcc/stmt.c +++ b/gcc/stmt.c @@ -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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 50de43f..539f572 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,4 +1,13 @@ -2003-02-05 Giovanni Bajo +2004-02-05 Rainer Orth + + PR middle-end/13750 + Revert: + 2004-01-15 Geoffrey Keating + PR pch/13361 + * testsuite/g++.dg/pch/wchar-1.C: New. + * testsuite/g++.dg/pch/wchar-1.Hs: New. + +2004-02-05 Giovanni Bajo 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 index 6cb5fe1..0000000 --- a/gcc/testsuite/g++.dg/pch/wchar-1.C +++ /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 index 431908b..0000000 --- a/gcc/testsuite/g++.dg/pch/wchar-1.Hs +++ /dev/null @@ -1,2 +0,0 @@ -#include -const wchar_t test_var[] = L"wide string"; diff --git a/gcc/tree.c b/gcc/tree.c index ac0da20..12eabd9 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -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; } diff --git a/gcc/tree.def b/gcc/tree.def index 48028ee..7891974 100644 --- a/gcc/tree.def +++ b/gcc/tree.def @@ -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 diff --git a/gcc/tree.h b/gcc/tree.h index 6c3bc71..930a1e1 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -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. */ -- cgit v1.1