summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsamuel <samuel@138bc75d-0d04-0410-961f-82ee72b054a4>1999-09-22 05:51:44 +0000
committersamuel <samuel@138bc75d-0d04-0410-961f-82ee72b054a4>1999-09-22 05:51:44 +0000
commit0f4dbfb982e350a2585bd8416ad8740661abebb2 (patch)
treed77f393f094055cf54780770525095be9da9ac8a
parent711575e5dabfc53f14d875185e1111e9073f0199 (diff)
downloadgcc-0f4dbfb982e350a2585bd8416ad8740661abebb2.tar.gz
Various fixes for problems discovered stress-testing GC.
* config/i386/i386.c (pic_label_name): Change to char pointer. (global_offset_table): New variable. (load_pic_register): Fill global_offset_table if it hasn't already been done. Allocate pic_label_name dynamically. * ggc.h (empty_string): New variable. * ggc-simple.c (empty_string): Likewise. (init_ggc): Allocate empty_string and add as root. * stmt.c (digit_strings): New variable. (init_stmt): Add last_block_end_note as root. Allocate and initialize digit_strings. (expand_asm_operands): Use empty_string and digit_string instead of string constants. * profile.c (init_arc_profiler): Allocate with ggc_alloc_string instead of xmalloc. (output_func_start_profiler): Likewise. * c-typeck.c (digest_init): Check if init is error_mark_node. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@29575 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/c-typeck.c4
-rw-r--r--gcc/config/i386/i386.c19
-rw-r--r--gcc/ggc-simple.c7
-rw-r--r--gcc/ggc.h3
-rw-r--r--gcc/profile.c7
-rw-r--r--gcc/stmt.c23
6 files changed, 48 insertions, 15 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index de982588d13..07836838f41 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -4494,8 +4494,8 @@ digest_init (type, init, require_constant, constructor_constant)
enum tree_code code = TREE_CODE (type);
tree inside_init = init;
- if (init == error_mark_node)
- return init;
+ if (type == error_mark_node || init == error_mark_node)
+ return error_mark_node;
/* Strip NON_LVALUE_EXPRs since we aren't using as an lvalue. */
/* Do not use STRIP_NOPS here. We do not want an enumerator
diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c
index 635b53537c1..f654db645d9 100644
--- a/gcc/config/i386/i386.c
+++ b/gcc/config/i386/i386.c
@@ -1357,8 +1357,9 @@ ix86_can_use_return_insn_p ()
return nregs == 0 || ! frame_pointer_needed;
}
-static char pic_label_name[32];
+static char *pic_label_name;
static int pic_label_output;
+static char *global_offset_table_name;
/* This function generates code for -fpic that loads %ebx with
the return address of the caller and then returns. */
@@ -1402,12 +1403,22 @@ load_pic_register ()
{
rtx gotsym, pclab;
- gotsym = gen_rtx_SYMBOL_REF (Pmode, "_GLOBAL_OFFSET_TABLE_");
+ if (global_offset_table_name == NULL)
+ {
+ global_offset_table_name =
+ ggc_alloc_string ("_GLOBAL_OFFSET_TABLE_", 21);
+ ggc_add_string_root (&global_offset_table_name, 1);
+ }
+ gotsym = gen_rtx_SYMBOL_REF (Pmode, global_offset_table_name);
if (TARGET_DEEP_BRANCH_PREDICTION)
{
- if (pic_label_name[0] == '\0')
- ASM_GENERATE_INTERNAL_LABEL (pic_label_name, "LPR", 0);
+ if (pic_label_name == NULL)
+ {
+ pic_label_name = ggc_alloc_string (NULL, 32);
+ ggc_add_string_root (&pic_label_name, 1);
+ ASM_GENERATE_INTERNAL_LABEL (pic_label_name, "LPR", 0);
+ }
pclab = gen_rtx_MEM (QImode, gen_rtx_SYMBOL_REF (Pmode, pic_label_name));
}
else
diff --git a/gcc/ggc-simple.c b/gcc/ggc-simple.c
index 3eeb8c38378..536a06e2515 100644
--- a/gcc/ggc-simple.c
+++ b/gcc/ggc-simple.c
@@ -48,6 +48,10 @@
#define GGC_ANY_MAGIC ((unsigned int)0xa9bacbdc)
#define GGC_ANY_MAGIC_MARK ((unsigned int)0xa9bacbdc | 1)
+/* Constants for general use. */
+
+char *empty_string;
+
/* Global lists of roots, rtxs, and trees. */
struct ggc_rtx
@@ -142,6 +146,9 @@ init_ggc PROTO ((void))
dump = fopen ("zgcdump", "w");
setlinebuf (dump);
#endif
+
+ ggc_alloc_string ("", 0);
+ ggc_add_string_root (&empty_string, 1);
}
/* Start a new GGC context. Memory allocated in previous contexts
diff --git a/gcc/ggc.h b/gcc/ggc.h
index de43e9e8ab5..49a8df00749 100644
--- a/gcc/ggc.h
+++ b/gcc/ggc.h
@@ -42,6 +42,9 @@ union tree_node;
struct varasm_status;
struct varray_head_tag;
+/* Constants for general use. */
+extern char *empty_string;
+
/* Manipulate global roots that are needed between calls to gc. */
void ggc_add_root PROTO ((void *base, int nelt, int size, void (*)(void *)));
void ggc_add_rtx_root PROTO ((struct rtx_def **, int nelt));
diff --git a/gcc/profile.c b/gcc/profile.c
index 871f55789cd..9e7cece72d0 100644
--- a/gcc/profile.c
+++ b/gcc/profile.c
@@ -1540,7 +1540,7 @@ static void
init_arc_profiler ()
{
/* Generate and save a copy of this so it can be shared. */
- char *name = xmalloc (20);
+ char *name = ggc_alloc_string (NULL, 20);
ASM_GENERATE_INTERNAL_LABEL (name, "LPBX", 2);
profiler_label = gen_rtx_SYMBOL_REF (Pmode, name);
ggc_add_rtx_root (&profiler_label, 1);
@@ -1678,10 +1678,11 @@ output_func_start_profiler ()
expand_function_start (fndecl, 0);
/* Actually generate the code to call __bb_init_func. */
- name = xmalloc (20);
+ name = ggc_alloc_string (NULL, 20);
ASM_GENERATE_INTERNAL_LABEL (name, "LPBX", 0);
table_address = force_reg (Pmode, gen_rtx_SYMBOL_REF (Pmode, name));
- emit_library_call (gen_rtx_SYMBOL_REF (Pmode, "__bb_init_func"), 0,
+ emit_library_call (gen_rtx_SYMBOL_REF
+ (Pmode, ggc_alloc_string ("__bb_init_func", 14)), 0,
mode, 1, table_address, Pmode);
expand_function_end (input_filename, lineno, 0);
diff --git a/gcc/stmt.c b/gcc/stmt.c
index 6483da5bcc5..f2180bf4944 100644
--- a/gcc/stmt.c
+++ b/gcc/stmt.c
@@ -401,6 +401,9 @@ struct stmt_status
/* Non-zero if we are using EH to handle cleanus. */
static int using_eh_for_cleanups_p = 0;
+/* Character strings, each containing a single decimal digit. */
+static char *digit_strings[10];
+
static int n_occurrences PROTO((int, const char *));
static void expand_goto_internal PROTO((tree, rtx, rtx));
@@ -592,7 +595,17 @@ mark_stmt_status (p)
void
init_stmt ()
{
+ int i;
+
gcc_obstack_init (&stmt_obstack);
+ ggc_add_rtx_root (&last_block_end_note, 1);
+
+ for (i = 0; i < 10; i++)
+ {
+ digit_strings[i] = ggc_alloc_string (NULL, 1);
+ digit_strings[i][0] = '0' + i;
+ }
+ ggc_add_string_root (digit_strings, 10);
}
void
@@ -1547,9 +1560,9 @@ expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line)
argvec = rtvec_alloc (ninputs);
constraints = rtvec_alloc (ninputs);
- body = gen_rtx_ASM_OPERANDS (VOIDmode,
- TREE_STRING_POINTER (string), "", 0, argvec,
- constraints, filename, line);
+ body = gen_rtx_ASM_OPERANDS (VOIDmode, TREE_STRING_POINTER (string),
+ empty_string, 0, argvec, constraints,
+ filename, line);
MEM_VOLATILE_P (body) = vol;
@@ -1717,14 +1730,12 @@ expand_asm_operands (string, outputs, inputs, clobbers, vol, filename, line)
/* For in-out operands, copy output rtx to input rtx. */
for (i = 0; i < ninout; i++)
{
- static char match[9+1][2]
- = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9"};
int j = inout_opnum[i];
XVECEXP (body, 3, ninputs - ninout + i) /* argvec */
= output_rtx[j];
XVECEXP (body, 4, ninputs - ninout + i) /* constraints */
- = gen_rtx_ASM_INPUT (inout_mode[i], match[j]);
+ = gen_rtx_ASM_INPUT (inout_mode[i], digit_strings[j]);
}
/* Now, for each output, construct an rtx