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  <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
This commit is contained in:
Rainer Orth 2004-02-05 21:56:38 +00:00
parent 687d688ee4
commit 839ee4bc57
13 changed files with 72 additions and 42 deletions

View 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> 2004-02-05 Joseph S. Myers <jsm@polyomino.org.uk>
* diagnostic.h (DEFINE_DIAGNOSTIC_KIND): Change parameter M to * diagnostic.h (DEFINE_DIAGNOSTIC_KIND): Change parameter M to

View File

@ -4112,6 +4112,9 @@ static int require_constant_elements;
such as (struct foo) {...}. */ such as (struct foo) {...}. */
static tree constructor_decl; 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. */ /* Nonzero if this is an initializer for a top-level decl. */
static int constructor_top_level; static int constructor_top_level;
@ -4183,6 +4186,7 @@ struct initializer_stack
{ {
struct initializer_stack *next; struct initializer_stack *next;
tree decl; tree decl;
const char *asmspec;
struct constructor_stack *constructor_stack; struct constructor_stack *constructor_stack;
struct constructor_range_stack *constructor_range_stack; struct constructor_range_stack *constructor_range_stack;
tree elements; tree elements;
@ -4199,12 +4203,17 @@ struct initializer_stack *initializer_stack;
/* Prepare to parse and output the initializer for variable DECL. */ /* Prepare to parse and output the initializer for variable DECL. */
void 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; const char *locus;
struct initializer_stack *p = xmalloc (sizeof (struct initializer_stack)); 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->decl = constructor_decl;
p->asmspec = constructor_asmspec;
p->require_constant_value = require_constant_value; p->require_constant_value = require_constant_value;
p->require_constant_elements = require_constant_elements; p->require_constant_elements = require_constant_elements;
p->constructor_stack = constructor_stack; p->constructor_stack = constructor_stack;
@ -4218,6 +4227,7 @@ start_init (tree decl, tree asmspec_tree ATTRIBUTE_UNUSED, int top_level)
initializer_stack = p; initializer_stack = p;
constructor_decl = decl; constructor_decl = decl;
constructor_asmspec = asmspec;
constructor_designated = 0; constructor_designated = 0;
constructor_top_level = top_level; constructor_top_level = top_level;
@ -4274,6 +4284,7 @@ finish_init (void)
free (spelling_base); free (spelling_base);
constructor_decl = p->decl; constructor_decl = p->decl;
constructor_asmspec = p->asmspec;
require_constant_value = p->require_constant_value; require_constant_value = p->require_constant_value;
require_constant_elements = p->require_constant_elements; require_constant_elements = p->require_constant_elements;
constructor_stack = p->constructor_stack; constructor_stack = p->constructor_stack;

View File

@ -6776,8 +6776,8 @@ sh_handle_sp_switch_attribute (tree *node, tree name, tree args,
} }
else else
{ {
const char *s = ggc_strdup (TREE_STRING_POINTER (TREE_VALUE (args))); sp_switch = gen_rtx_SYMBOL_REF (VOIDmode,
sp_switch = gen_rtx_SYMBOL_REF (VOIDmode, s); TREE_STRING_POINTER (TREE_VALUE (args)));
} }
return NULL_TREE; return NULL_TREE;

View 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> 2004-02-05 Mark Mitchell <mark@codesourcery.com>
PR c++/13714 PR c++/13714

View File

@ -535,7 +535,7 @@ handle_pragma_interface (cpp_reader* dfile ATTRIBUTE_UNUSED )
else if (fname == 0) else if (fname == 0)
main_filename = lbasename (input_filename); main_filename = lbasename (input_filename);
else else
main_filename = ggc_strdup (TREE_STRING_POINTER (fname)); main_filename = TREE_STRING_POINTER (fname);
finfo = get_fileinfo (input_filename); finfo = get_fileinfo (input_filename);
@ -585,7 +585,7 @@ handle_pragma_implementation (cpp_reader* dfile ATTRIBUTE_UNUSED )
} }
else else
{ {
main_filename = ggc_strdup (TREE_STRING_POINTER (fname)); main_filename = TREE_STRING_POINTER (fname);
if (cpp_included (parse_in, main_filename)) if (cpp_included (parse_in, main_filename))
warning ("#pragma implementation for %s appears after file is included", warning ("#pragma implementation for %s appears after file is included",
main_filename); main_filename);

View File

@ -9429,8 +9429,7 @@ rtl_for_decl_location (tree decl)
TREE_STRING_LENGTH (init) - 1) == 0 TREE_STRING_LENGTH (init) - 1) == 0
&& ((size_t) TREE_STRING_LENGTH (init) && ((size_t) TREE_STRING_LENGTH (init)
== strlen (TREE_STRING_POINTER (init)) + 1)) == strlen (TREE_STRING_POINTER (init)) + 1))
rtl = gen_rtx_CONST_STRING (VOIDmode, rtl = gen_rtx_CONST_STRING (VOIDmode, TREE_STRING_POINTER (init));
ggc_strdup (TREE_STRING_POINTER (init)));
} }
/* If the initializer is something that we know will expand into an /* If the initializer is something that we know will expand into an
immediate RTL constant, expand it now. Expanding anything else immediate RTL constant, expand it now. Expanding anything else

View File

@ -1102,8 +1102,7 @@ expand_asm (tree string, int vol)
if (TREE_CODE (string) == ADDR_EXPR) if (TREE_CODE (string) == ADDR_EXPR)
string = TREE_OPERAND (string, 0); string = TREE_OPERAND (string, 0);
body = gen_rtx_ASM_INPUT (VOIDmode, body = gen_rtx_ASM_INPUT (VOIDmode, TREE_STRING_POINTER (string));
ggc_strdup (TREE_STRING_POINTER (string)));
MEM_VOLATILE_P (body) = vol; 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 body = gen_rtx_ASM_OPERANDS ((noutputs == 0 ? VOIDmode
: GET_MODE (output_rtx[0])), : GET_MODE (output_rtx[0])),
ggc_strdup (TREE_STRING_POINTER (string)), TREE_STRING_POINTER (string),
empty_string, 0, argvec, constraintvec, empty_string, 0, argvec, constraintvec,
locus.file, locus.line); 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 (body, i) = op;
ASM_OPERANDS_INPUT_CONSTRAINT_EXP (body, i) ASM_OPERANDS_INPUT_CONSTRAINT_EXP (body, i)
= gen_rtx_ASM_INPUT (TYPE_MODE (type), = gen_rtx_ASM_INPUT (TYPE_MODE (type), constraints[i + noutputs]);
ggc_strdup (constraints[i + noutputs]));
if (decl_conflicts_with_clobbers_p (val, clobbered_regs)) if (decl_conflicts_with_clobbers_p (val, clobbered_regs))
clobber_conflict_found = 1; clobber_conflict_found = 1;
@ -1788,7 +1786,7 @@ expand_asm_operands (tree string, tree outputs, tree inputs,
if (noutputs == 1 && nclobbers == 0) 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)); 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], output_rtx[i],
gen_rtx_ASM_OPERANDS gen_rtx_ASM_OPERANDS
(GET_MODE (output_rtx[i]), (GET_MODE (output_rtx[i]),
ggc_strdup (TREE_STRING_POINTER (string)), TREE_STRING_POINTER (string),
ggc_strdup (constraints[i]), constraints[i], i, argvec, constraintvec,
i, argvec, constraintvec,
locus.file, locus.line)); locus.file, locus.line));
MEM_VOLATILE_P (SET_SRC (XVECEXP (body, 0, i))) = vol; MEM_VOLATILE_P (SET_SRC (XVECEXP (body, 0, i))) = vol;

View 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 PR c++/14008
* g++.dg/parse/error15.C: New test. * g++.dg/parse/error15.C: New test.

View File

@ -1 +0,0 @@
#include "wchar-1.H"

View File

@ -1,2 +0,0 @@
#include <stddef.h>
const wchar_t test_var[] = L"wide string";

View File

@ -168,8 +168,7 @@ tree_size (tree node)
case REAL_CST: return sizeof (struct tree_real_cst); case REAL_CST: return sizeof (struct tree_real_cst);
case COMPLEX_CST: return sizeof (struct tree_complex); case COMPLEX_CST: return sizeof (struct tree_complex);
case VECTOR_CST: return sizeof (struct tree_vector); case VECTOR_CST: return sizeof (struct tree_vector);
case STRING_CST: case STRING_CST: return sizeof (struct tree_string);
return sizeof (struct tree_string) + TREE_STRING_LENGTH (node);
default: default:
return (*lang_hooks.tree_size) (code); return (*lang_hooks.tree_size) (code);
} }
@ -213,8 +212,8 @@ make_node (enum tree_code code)
struct tree_common ttmp; struct tree_common ttmp;
/* We can't allocate a TREE_VEC without knowing how many elements /* We can't allocate a TREE_VEC without knowing how many elements
it will have; likewise a STRING_CST without knowing the length. */ it will have. */
if (code == TREE_VEC || code == STRING_CST) if (code == TREE_VEC)
abort (); abort ();
TREE_SET_CODE ((tree)&ttmp, code); TREE_SET_CODE ((tree)&ttmp, code);
@ -526,23 +525,10 @@ build_real_from_int_cst (tree type, tree i)
tree tree
build_string (int len, const char *str) build_string (int len, const char *str)
{ {
tree s; tree s = make_node (STRING_CST);
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);
memset (s, 0, sizeof (struct tree_common));
TREE_SET_CODE (s, STRING_CST);
TREE_STRING_LENGTH (s) = len; TREE_STRING_LENGTH (s) = len;
memcpy ((char *) TREE_STRING_POINTER (s), str, len); TREE_STRING_POINTER (s) = ggc_alloc_string (str, len);
((char *) TREE_STRING_POINTER (s))[len] = '\0';
return s; return s;
} }

View File

@ -274,7 +274,7 @@ DEFTREECODE (COMPLEX_CST, "complex_cst", 'c', 0)
/* Contents are in TREE_VECTOR_CST_ELTS field. */ /* Contents are in TREE_VECTOR_CST_ELTS field. */
DEFTREECODE (VECTOR_CST, "vector_cst", 'c', 0) 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) DEFTREECODE (STRING_CST, "string_cst", 'c', 0)
/* Declarations. All references to names are represented as ..._DECL /* Declarations. All references to names are represented as ..._DECL

View File

@ -707,13 +707,13 @@ struct tree_real_cst GTY(())
/* In a STRING_CST */ /* In a STRING_CST */
#define TREE_STRING_LENGTH(NODE) (STRING_CST_CHECK (NODE)->string.length) #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_string GTY(())
{ {
struct tree_common common; struct tree_common common;
int length; int length;
const char str[1]; const char *pointer;
}; };
/* In a COMPLEX_CST node. */ /* In a COMPLEX_CST node. */