aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog51
-rw-r--r--gcc/config/i386/driver-i386.c18
-rw-r--r--gcc/ggc-common.c19
-rw-r--r--gcc/ggc-page.c33
-rw-r--r--gcc/global.c2
-rw-r--r--gcc/graph.c6
-rw-r--r--gcc/haifa-sched.c11
-rw-r--r--gcc/integrate.c9
-rw-r--r--gcc/ipa-prop.c2
-rw-r--r--gcc/ipa-struct-reorg.c4
-rw-r--r--gcc/local-alloc.c2
-rw-r--r--gcc/loop-invariant.c14
-rw-r--r--gcc/loop-iv.c10
-rw-r--r--gcc/loop-unroll.c25
-rw-r--r--gcc/matrix-reorg.c42
-rw-r--r--gcc/omp-low.c18
-rw-r--r--gcc/optabs.c20
-rw-r--r--gcc/opts-common.c4
-rw-r--r--gcc/opts.c6
-rw-r--r--gcc/params.c4
-rw-r--r--gcc/passes.c8
-rw-r--r--gcc/postreload.c8
-rw-r--r--gcc/predict.c10
23 files changed, 195 insertions, 131 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 96a896b..e080d76 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,56 @@
2008-06-25 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+ * config/i386/driver-i386.c (detect_caches_amd,
+ detect_caches_intel, host_detect_local_cpu): Fix -Wc++-compat
+ and/or -Wcast-qual warnings.
+ *ggc-common.c (ggc_mark_roots, gt_pch_note_object,
+ gt_pch_note_reorder, relocate_ptrs, write_pch_globals,
+ gt_pch_save): Likewise.
+ * ggc-page.c (push_depth, push_by_depth, alloc_anon, alloc_page,
+ gt_ggc_m_S, clear_marks, ggc_pch_read): Likewise.
+ * global.c (compute_regsets): Likewise.
+ * graph.c (print_rtl_graph_with_bb, clean_graph_dump_file,
+ finish_graph_dump_file): Likewise.
+ * haifa-sched.c (schedule_block, extend_h_i_d, extend_ready,
+ unlink_bb_notes): Likewise.
+ * integrate.c (get_hard_reg_initial_val): Likewise.
+ * ipa-prop.c (ipa_push_func_to_list): Likewise.
+ * ipa-struct-reorg.c (gen_var_name, gen_cluster_name): Likewise.
+ * local-alloc.c (update_equiv_regs): Likewise.
+ * loop-invariant.c (check_invariant_table_size,
+ hash_invariant_expr, eq_invariant_expr, find_or_insert_inv):
+ Likewise.
+ * loop-iv.c (check_iv_ref_table_size, analyzed_for_bivness_p,
+ altered_reg_used, mark_altered): Likewise.
+ * loop-unroll.c (si_info_eq, ve_info_eq, allocate_basic_variable,
+ insert_var_expansion_initialization,
+ combine_var_copies_in_loop_exit, apply_opt_in_copies,
+ release_var_copies): Likewise.
+ * matrix-reorg.c (mat_acc_phi_hash, mat_acc_phi_eq, mtt_info_eq,
+ analyze_matrix_decl, add_allocation_site, analyze_transpose,
+ analyze_accesses_for_phi_node, check_var_notmodified_p,
+ check_allocation_function, find_sites_in_func,
+ record_all_accesses_in_func, transform_access_sites,
+ transform_allocation_sites): Likewise.
+ * omp-low.c (new_omp_region, create_omp_child_function_name,
+ check_omp_nesting_restrictions, check_combined_parallel,
+ lower_omp_2, diagnose_sb_1, diagnose_sb_2): Likewise.
+ * optabs.c (no_conflict_move_test, gen_libfunc, gen_fp_libfunc,
+ gen_intv_fp_libfunc, gen_interclass_conv_libfunc,
+ gen_intraclass_conv_libfunc, set_optab_libfunc, set_conv_libfunc):
+ Likewise.
+ * opts-common.c (prune_options): Likewise.
+ * opts.c (add_input_filename, print_filtered_help,
+ get_option_state): Likewise.
+ * params.c (add_params): Likewise.
+ * passes.c (set_pass_for_id, next_pass_1,
+ do_per_function_toporder, pass_fini_dump_file): Likewise.
+ * postreload.c (reload_cse_simplify_operands): Likewise.
+ * predict.c (tree_predicted_by_p, tree_predict_edge,
+ clear_bb_predictions, combine_predictions_for_bb): Likewise.
+
+2008-06-25 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
+
* ra.h (add_neighbor): Fix -Wc++-compat and/or -Wcast-qual
warnings.
* recog.c (check_asm_operands, validate_change_1): Likewise.
diff --git a/gcc/config/i386/driver-i386.c b/gcc/config/i386/driver-i386.c
index b823d43..44845cd 100644
--- a/gcc/config/i386/driver-i386.c
+++ b/gcc/config/i386/driver-i386.c
@@ -70,7 +70,7 @@ decode_l2_cache (unsigned *l2_size, unsigned *l2_line, unsigned *l2_assoc)
/* Returns the description of caches for an AMD processor. */
-static char *
+static const char *
detect_caches_amd (unsigned max_ext_level)
{
unsigned eax, ebx, ecx, edx;
@@ -78,7 +78,7 @@ detect_caches_amd (unsigned max_ext_level)
unsigned l2_sizekb, l2_line, l2_assoc;
if (max_ext_level < 0x80000005)
- return (char *) "";
+ return "";
__cpuid (0x80000005, eax, ebx, ecx, edx);
@@ -282,7 +282,7 @@ decode_caches_intel (unsigned reg, unsigned *l1_sizekb, unsigned *l1_line,
/* Returns the description of caches for an intel processor. */
-static char *
+static const char *
detect_caches_intel (unsigned max_level, unsigned max_ext_level)
{
unsigned eax, ebx, ecx, edx;
@@ -290,7 +290,7 @@ detect_caches_intel (unsigned max_level, unsigned max_ext_level)
unsigned l2_sizekb = 0, l2_line = 0, l2_assoc = 0;
if (max_level < 2)
- return (char *) "";
+ return "";
__cpuid (2, eax, ebx, ecx, edx);
@@ -304,7 +304,7 @@ detect_caches_intel (unsigned max_level, unsigned max_ext_level)
&l2_sizekb, &l2_line, &l2_assoc);
if (!l1_sizekb)
- return (char *) "";
+ return "";
/* Newer Intel CPUs are equipped with AMD style L2 cache info */
if (max_ext_level >= 0x80000006)
@@ -393,13 +393,13 @@ const char *host_detect_local_cpu (int argc, const char **argv)
if (!arch)
{
- if (vendor == *(unsigned int*) "Auth")
+ if (vendor == *(const unsigned int*) "Auth")
cache = detect_caches_amd (ext_level);
- else if (vendor == *(unsigned int*) "Genu")
+ else if (vendor == *(const unsigned int*) "Genu")
cache = detect_caches_intel (max_level, ext_level);
}
- if (vendor == *(unsigned int*) "Auth")
+ if (vendor == *(const unsigned int*) "Auth")
{
processor = PROCESSOR_PENTIUM;
@@ -412,7 +412,7 @@ const char *host_detect_local_cpu (int argc, const char **argv)
if (has_sse4a)
processor = PROCESSOR_AMDFAM10;
}
- else if (vendor == *(unsigned int*) "Geod")
+ else if (vendor == *(const unsigned int*) "Geod")
processor = PROCESSOR_GEODE;
else
{
diff --git a/gcc/ggc-common.c b/gcc/ggc-common.c
index 17c1f50..a01fa3f 100644
--- a/gcc/ggc-common.c
+++ b/gcc/ggc-common.c
@@ -116,7 +116,8 @@ ggc_mark_roots (void)
if (*cti->base)
{
ggc_set_mark (*cti->base);
- htab_traverse_noresize (*cti->base, ggc_htab_delete, (void *) cti);
+ htab_traverse_noresize (*cti->base, ggc_htab_delete,
+ CONST_CAST (void *, (const void *)cti));
ggc_set_mark ((*cti->base)->entries);
}
@@ -264,12 +265,12 @@ gt_pch_note_object (void *obj, void *note_ptr_cookie,
return 0;
}
- *slot = xcalloc (sizeof (struct ptr_data), 1);
+ *slot = XCNEW (struct ptr_data);
(*slot)->obj = obj;
(*slot)->note_ptr_fn = note_ptr_fn;
(*slot)->note_ptr_cookie = note_ptr_cookie;
if (note_ptr_fn == gt_pch_p_S)
- (*slot)->size = strlen (obj) + 1;
+ (*slot)->size = strlen ((const char *)obj) + 1;
else
(*slot)->size = ggc_get_size (obj);
(*slot)->type = type;
@@ -287,7 +288,8 @@ gt_pch_note_reorder (void *obj, void *note_ptr_cookie,
if (obj == NULL || obj == (void *) 1)
return;
- data = htab_find_with_hash (saving_htab, obj, POINTER_HASH (obj));
+ data = (struct ptr_data *)
+ htab_find_with_hash (saving_htab, obj, POINTER_HASH (obj));
gcc_assert (data && data->note_ptr_cookie == note_ptr_cookie);
data->reorder_fn = reorder_fn;
@@ -370,7 +372,8 @@ relocate_ptrs (void *ptr_p, void *state_p)
if (*ptr == NULL || *ptr == (void *)1)
return;
- result = htab_find_with_hash (saving_htab, *ptr, POINTER_HASH (*ptr));
+ result = (struct ptr_data *)
+ htab_find_with_hash (saving_htab, *ptr, POINTER_HASH (*ptr));
gcc_assert (result);
*ptr = result->new_addr;
}
@@ -398,8 +401,8 @@ write_pch_globals (const struct ggc_root_tab * const *tab,
}
else
{
- new_ptr = htab_find_with_hash (saving_htab, ptr,
- POINTER_HASH (ptr));
+ new_ptr = (struct ptr_data *)
+ htab_find_with_hash (saving_htab, ptr, POINTER_HASH (ptr));
if (fwrite (&new_ptr->new_addr, sizeof (void *), 1, state->f)
!= 1)
fatal_error ("can't write PCH file: %m");
@@ -502,7 +505,7 @@ gt_pch_save (FILE *f)
if (this_object_size < state.ptrs[i]->size)
{
this_object_size = state.ptrs[i]->size;
- this_object = xrealloc (this_object, this_object_size);
+ this_object = XRESIZEVAR (char, this_object, this_object_size);
}
memcpy (this_object, state.ptrs[i]->obj, state.ptrs[i]->size);
if (state.ptrs[i]->reorder_fn != NULL)
diff --git a/gcc/ggc-page.c b/gcc/ggc-page.c
index 416f911..14e0776 100644
--- a/gcc/ggc-page.c
+++ b/gcc/ggc-page.c
@@ -503,7 +503,7 @@ push_depth (unsigned int i)
if (G.depth_in_use >= G.depth_max)
{
G.depth_max *= 2;
- G.depth = xrealloc (G.depth, G.depth_max * sizeof (unsigned int));
+ G.depth = XRESIZEVEC (unsigned int, G.depth, G.depth_max);
}
G.depth[G.depth_in_use++] = i;
}
@@ -516,10 +516,9 @@ push_by_depth (page_entry *p, unsigned long *s)
if (G.by_depth_in_use >= G.by_depth_max)
{
G.by_depth_max *= 2;
- G.by_depth = xrealloc (G.by_depth,
- G.by_depth_max * sizeof (page_entry *));
- G.save_in_use = xrealloc (G.save_in_use,
- G.by_depth_max * sizeof (unsigned long *));
+ G.by_depth = XRESIZEVEC (page_entry *, G.by_depth, G.by_depth_max);
+ G.save_in_use = XRESIZEVEC (unsigned long *, G.save_in_use,
+ G.by_depth_max);
}
G.by_depth[G.by_depth_in_use] = p;
G.save_in_use[G.by_depth_in_use++] = s;
@@ -657,12 +656,12 @@ static inline char *
alloc_anon (char *pref ATTRIBUTE_UNUSED, size_t size)
{
#ifdef HAVE_MMAP_ANON
- char *page = mmap (pref, size, PROT_READ | PROT_WRITE,
- MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
+ char *page = (char *) mmap (pref, size, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
#endif
#ifdef HAVE_MMAP_DEV_ZERO
- char *page = mmap (pref, size, PROT_READ | PROT_WRITE,
- MAP_PRIVATE, G.dev_zero_fd, 0);
+ char *page = (char *) mmap (pref, size, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE, G.dev_zero_fd, 0);
#endif
if (page == (char *) MAP_FAILED)
@@ -772,7 +771,7 @@ alloc_page (unsigned order)
memory order. */
for (i = GGC_QUIRE_SIZE - 1; i >= 1; i--)
{
- e = xcalloc (1, page_entry_size);
+ e = XCNEWVAR (struct page_entry, page_entry_size);
e->order = order;
e->bytes = G.pagesize;
e->page = page + (i << G.lg_pagesize);
@@ -857,7 +856,7 @@ alloc_page (unsigned order)
#endif
if (entry == NULL)
- entry = xcalloc (1, page_entry_size);
+ entry = XCNEWVAR (struct page_entry, page_entry_size);
entry->bytes = entry_size;
entry->page = page;
@@ -1285,7 +1284,7 @@ gt_ggc_m_S (const void *p)
a STRING_CST. */
gcc_assert (offset == offsetof (struct tree_string, str));
p = ((const char *) p) - offset;
- gt_ggc_mx_lang_tree_node ((void *) p);
+ gt_ggc_mx_lang_tree_node (CONST_CAST (void *, p));
return;
}
@@ -1666,7 +1665,7 @@ clear_marks (void)
if (p->context_depth < G.context_depth)
{
if (! save_in_use_p (p))
- save_in_use_p (p) = xmalloc (bitmap_size);
+ save_in_use_p (p) = XNEWVAR (unsigned long, bitmap_size);
memcpy (save_in_use_p (p), p->in_use_p, bitmap_size);
}
@@ -2272,7 +2271,7 @@ ggc_pch_read (FILE *f, void *addr)
{
struct ggc_pch_ondisk d;
unsigned i;
- char *offs = addr;
+ char *offs = (char *) addr;
unsigned long count_old_page_tables;
unsigned long count_new_page_tables;
@@ -2318,9 +2317,9 @@ ggc_pch_read (FILE *f, void *addr)
bytes = ROUND_UP (d.totals[i] * OBJECT_SIZE (i), G.pagesize);
num_objs = bytes / OBJECT_SIZE (i);
- entry = xcalloc (1, (sizeof (struct page_entry)
- - sizeof (long)
- + BITMAP_SIZE (num_objs + 1)));
+ entry = XCNEWVAR (struct page_entry, (sizeof (struct page_entry)
+ - sizeof (long)
+ + BITMAP_SIZE (num_objs + 1)));
entry->bytes = bytes;
entry->page = offs;
entry->context_depth = 0;
diff --git a/gcc/global.c b/gcc/global.c
index cddcac3..8ccad6b 100644
--- a/gcc/global.c
+++ b/gcc/global.c
@@ -216,7 +216,7 @@ compute_regsets (HARD_REG_SET *elim_set,
/* Like regs_ever_live, but 1 if a reg is set or clobbered from an asm.
Unlike regs_ever_live, elements of this array corresponding to
eliminable regs like the frame pointer are set if an asm sets them. */
- char *regs_asm_clobbered = alloca (FIRST_PSEUDO_REGISTER * sizeof (char));
+ char *regs_asm_clobbered = XALLOCAVEC (char, FIRST_PSEUDO_REGISTER);
#ifdef ELIMINABLE_REGS
static const struct {const int from, to; } eliminables[] = ELIMINABLE_REGS;
diff --git a/gcc/graph.c b/gcc/graph.c
index 56fbc8c..e59adbc 100644
--- a/gcc/graph.c
+++ b/gcc/graph.c
@@ -226,7 +226,7 @@ print_rtl_graph_with_bb (const char *base, rtx rtx_first)
rtx tmp_rtx;
size_t namelen = strlen (base);
size_t extlen = strlen (graph_ext[graph_dump_format]) + 1;
- char *buf = alloca (namelen + extlen);
+ char *buf = XALLOCAVEC (char, namelen + extlen);
FILE *fp;
if (basic_block_info == NULL)
@@ -389,7 +389,7 @@ clean_graph_dump_file (const char *base)
{
size_t namelen = strlen (base);
size_t extlen = strlen (graph_ext[graph_dump_format]) + 1;
- char *buf = alloca (namelen + extlen);
+ char *buf = XALLOCAVEC (char, namelen + extlen);
FILE *fp;
memcpy (buf, base, namelen);
@@ -413,7 +413,7 @@ finish_graph_dump_file (const char *base)
{
size_t namelen = strlen (base);
size_t extlen = strlen (graph_ext[graph_dump_format]) + 1;
- char *buf = alloca (namelen + extlen);
+ char *buf = XALLOCAVEC (char, namelen + extlen);
FILE *fp;
memcpy (buf, base, namelen);
diff --git a/gcc/haifa-sched.c b/gcc/haifa-sched.c
index bb799f9..8d5b38b 100644
--- a/gcc/haifa-sched.c
+++ b/gcc/haifa-sched.c
@@ -2179,7 +2179,7 @@ schedule_block (basic_block *target_bb, int rgn_n_insns1)
q_ptr = 0;
q_size = 0;
- insn_queue = alloca ((max_insn_queue_index + 1) * sizeof (rtx));
+ insn_queue = XALLOCAVEC (rtx, max_insn_queue_index + 1);
memset (insn_queue, 0, (max_insn_queue_index + 1) * sizeof (rtx));
/* Start just before the beginning of time. */
@@ -3158,7 +3158,8 @@ extend_h_i_d (void)
pseudos which do not cross calls. */
int new_max_uid = get_max_uid () + 1;
- h_i_d = xrecalloc (h_i_d, new_max_uid, old_max_uid, sizeof (*h_i_d));
+ h_i_d = (struct haifa_insn_data *)
+ xrecalloc (h_i_d, new_max_uid, old_max_uid, sizeof (*h_i_d));
old_max_uid = new_max_uid;
if (targetm.sched.h_i_d_extended)
@@ -3175,8 +3176,8 @@ extend_ready (int n_new_insns)
readyp->veclen = rgn_n_insns + n_new_insns + 1 + issue_rate;
readyp->vec = XRESIZEVEC (rtx, readyp->vec, readyp->veclen);
- ready_try = xrecalloc (ready_try, rgn_n_insns + n_new_insns + 1,
- rgn_n_insns + 1, sizeof (char));
+ ready_try = (char *) xrecalloc (ready_try, rgn_n_insns + n_new_insns + 1,
+ rgn_n_insns + 1, sizeof (char));
rgn_n_insns += n_new_insns;
@@ -4098,7 +4099,7 @@ unlink_bb_notes (basic_block first, basic_block last)
if (first == last)
return;
- bb_header = xmalloc (last_basic_block * sizeof (*bb_header));
+ bb_header = XNEWVEC (rtx, last_basic_block);
/* Make a sentinel. */
if (last->next_bb != EXIT_BLOCK_PTR)
diff --git a/gcc/integrate.c b/gcc/integrate.c
index 4ed42ef..d29aab6 100644
--- a/gcc/integrate.c
+++ b/gcc/integrate.c
@@ -237,19 +237,18 @@ get_hard_reg_initial_val (enum machine_mode mode, unsigned int regno)
ivs = crtl->hard_reg_initial_vals;
if (ivs == 0)
{
- ivs = ggc_alloc (sizeof (initial_value_struct));
+ ivs = GGC_NEW (initial_value_struct);
ivs->num_entries = 0;
ivs->max_entries = 5;
- ivs->entries = ggc_alloc (5 * sizeof (initial_value_pair));
+ ivs->entries = GGC_NEWVEC (initial_value_pair, 5);
crtl->hard_reg_initial_vals = ivs;
}
if (ivs->num_entries >= ivs->max_entries)
{
ivs->max_entries += 5;
- ivs->entries = ggc_realloc (ivs->entries,
- ivs->max_entries
- * sizeof (initial_value_pair));
+ ivs->entries = GGC_RESIZEVEC (initial_value_pair, ivs->entries,
+ ivs->max_entries);
}
ivs->entries[ivs->num_entries].hard_reg = gen_rtx_REG (mode, regno);
diff --git a/gcc/ipa-prop.c b/gcc/ipa-prop.c
index f040363..c5b4c9a 100644
--- a/gcc/ipa-prop.c
+++ b/gcc/ipa-prop.c
@@ -52,7 +52,7 @@ ipa_push_func_to_list (struct ipa_func_list **wl, struct cgraph_node *mt)
{
struct ipa_func_list *temp;
- temp = xcalloc (1, sizeof (struct ipa_func_list));
+ temp = XCNEW (struct ipa_func_list);
temp->node = mt;
temp->next = *wl;
*wl = temp;
diff --git a/gcc/ipa-struct-reorg.c b/gcc/ipa-struct-reorg.c
index cce9b3f..fffb454 100644
--- a/gcc/ipa-struct-reorg.c
+++ b/gcc/ipa-struct-reorg.c
@@ -1954,7 +1954,7 @@ gen_var_name (tree orig_decl, unsigned HOST_WIDE_INT i)
appropriate new name for the new variable. */
old_name = IDENTIFIER_POINTER (DECL_NAME (orig_decl));
- prefix = alloca (strlen (old_name) + 1);
+ prefix = XALLOCAVEC (char, strlen (old_name) + 1);
strcpy (prefix, old_name);
ASM_FORMAT_PRIVATE_NAME (new_name, prefix, i);
return get_identifier (new_name);
@@ -2827,7 +2827,7 @@ gen_cluster_name (tree decl, int clust_num, int str_num)
ASM_FORMAT_PRIVATE_NAME(tmp_name, "struct", str_num);
len = strlen (tmp_name ? tmp_name : orig_name) + strlen ("_sub");
- prefix = alloca (len + 1);
+ prefix = XALLOCAVEC (char, len + 1);
memcpy (prefix, tmp_name ? tmp_name : orig_name,
strlen (tmp_name ? tmp_name : orig_name));
strcpy (prefix + strlen (tmp_name ? tmp_name : orig_name), "_sub");
diff --git a/gcc/local-alloc.c b/gcc/local-alloc.c
index 0ee20b2..e1c8e47 100644
--- a/gcc/local-alloc.c
+++ b/gcc/local-alloc.c
@@ -806,7 +806,7 @@ update_equiv_regs (void)
bitmap cleared_regs;
reg_equiv = XCNEWVEC (struct equivalence, max_regno);
- reg_equiv_init = ggc_alloc_cleared (max_regno * sizeof (rtx));
+ reg_equiv_init = GGC_CNEWVEC (rtx, max_regno);
reg_equiv_init_size = max_regno;
init_alias_analysis ();
diff --git a/gcc/loop-invariant.c b/gcc/loop-invariant.c
index dd75b3a..40e70ba 100644
--- a/gcc/loop-invariant.c
+++ b/gcc/loop-invariant.c
@@ -164,8 +164,7 @@ check_invariant_table_size (void)
if (invariant_table_size < DF_DEFS_TABLE_SIZE())
{
unsigned int new_size = DF_DEFS_TABLE_SIZE () + (DF_DEFS_TABLE_SIZE () / 4);
- invariant_table = xrealloc (invariant_table,
- sizeof (struct rtx_iv *) * new_size);
+ invariant_table = XRESIZEVEC (struct invariant *, invariant_table, new_size);
memset (&invariant_table[invariant_table_size], 0,
(new_size - invariant_table_size) * sizeof (struct rtx_iv *));
invariant_table_size = new_size;
@@ -417,7 +416,8 @@ invariant_expr_equal_p (rtx insn1, rtx e1, rtx insn2, rtx e2)
static hashval_t
hash_invariant_expr (const void *e)
{
- const struct invariant_expr_entry *entry = e;
+ const struct invariant_expr_entry *const entry =
+ (const struct invariant_expr_entry *) e;
return entry->hash;
}
@@ -427,8 +427,10 @@ hash_invariant_expr (const void *e)
static int
eq_invariant_expr (const void *e1, const void *e2)
{
- const struct invariant_expr_entry *entry1 = e1;
- const struct invariant_expr_entry *entry2 = e2;
+ const struct invariant_expr_entry *const entry1 =
+ (const struct invariant_expr_entry *) e1;
+ const struct invariant_expr_entry *const entry2 =
+ (const struct invariant_expr_entry *) e2;
if (entry1->mode != entry2->mode)
return 0;
@@ -454,7 +456,7 @@ find_or_insert_inv (htab_t eq, rtx expr, enum machine_mode mode,
pentry.inv = inv;
pentry.mode = mode;
slot = htab_find_slot_with_hash (eq, &pentry, hash, INSERT);
- entry = *slot;
+ entry = (struct invariant_expr_entry *) *slot;
if (entry)
return entry->inv;
diff --git a/gcc/loop-iv.c b/gcc/loop-iv.c
index b7b1cd3..e063597 100644
--- a/gcc/loop-iv.c
+++ b/gcc/loop-iv.c
@@ -173,8 +173,7 @@ check_iv_ref_table_size (void)
if (iv_ref_table_size < DF_DEFS_TABLE_SIZE())
{
unsigned int new_size = DF_DEFS_TABLE_SIZE () + (DF_DEFS_TABLE_SIZE () / 4);
- iv_ref_table = xrealloc (iv_ref_table,
- sizeof (struct rtx_iv *) * new_size);
+ iv_ref_table = XRESIZEVEC (struct rtx_iv *, iv_ref_table, new_size);
memset (&iv_ref_table[iv_ref_table_size], 0,
(new_size - iv_ref_table_size) * sizeof (struct rtx_iv *));
iv_ref_table_size = new_size;
@@ -819,7 +818,8 @@ record_iv (struct df_ref *def, struct rtx_iv *iv)
static bool
analyzed_for_bivness_p (rtx def, struct rtx_iv *iv)
{
- struct biv_entry *biv = htab_find_with_hash (bivs, def, REGNO (def));
+ struct biv_entry *biv =
+ (struct biv_entry *) htab_find_with_hash (bivs, def, REGNO (def));
if (!biv)
return false;
@@ -1304,7 +1304,7 @@ altered_reg_used (rtx *reg, void *alt)
if (!REG_P (*reg))
return 0;
- return REGNO_REG_SET_P (alt, REGNO (*reg));
+ return REGNO_REG_SET_P ((bitmap) alt, REGNO (*reg));
}
/* Marks registers altered by EXPR in set ALT. */
@@ -1317,7 +1317,7 @@ mark_altered (rtx expr, const_rtx by ATTRIBUTE_UNUSED, void *alt)
if (!REG_P (expr))
return;
- SET_REGNO_REG_SET (alt, REGNO (expr));
+ SET_REGNO_REG_SET ((bitmap) alt, REGNO (expr));
}
/* Checks whether RHS is simple enough to process. */
diff --git a/gcc/loop-unroll.c b/gcc/loop-unroll.c
index e57e8e6..b6dc266 100644
--- a/gcc/loop-unroll.c
+++ b/gcc/loop-unroll.c
@@ -1491,8 +1491,8 @@ si_info_hash (const void *ivts)
static int
si_info_eq (const void *ivts1, const void *ivts2)
{
- const struct iv_to_split *i1 = ivts1;
- const struct iv_to_split *i2 = ivts2;
+ const struct iv_to_split *const i1 = (const struct iv_to_split *) ivts1;
+ const struct iv_to_split *const i2 = (const struct iv_to_split *) ivts2;
return i1->insn == i2->insn;
}
@@ -1511,8 +1511,8 @@ ve_info_hash (const void *ves)
static int
ve_info_eq (const void *ivts1, const void *ivts2)
{
- const struct var_to_expand *i1 = ivts1;
- const struct var_to_expand *i2 = ivts2;
+ const struct var_to_expand *const i1 = (const struct var_to_expand *) ivts1;
+ const struct var_to_expand *const i2 = (const struct var_to_expand *) ivts2;
return i1->insn == i2->insn;
}
@@ -1867,7 +1867,7 @@ get_ivts_expr (rtx expr, struct iv_to_split *ivts)
static int
allocate_basic_variable (void **slot, void *data ATTRIBUTE_UNUSED)
{
- struct iv_to_split *ivts = *slot;
+ struct iv_to_split *ivts = (struct iv_to_split *) *slot;
rtx expr = *get_ivts_expr (single_set (ivts->insn), ivts);
ivts->base_var = gen_reg_rtx (GET_MODE (expr));
@@ -2040,7 +2040,7 @@ expand_var_during_unrolling (struct var_to_expand *ve, rtx insn)
static int
insert_var_expansion_initialization (void **slot, void *place_p)
{
- struct var_to_expand *ve = *slot;
+ struct var_to_expand *ve = (struct var_to_expand *) *slot;
basic_block place = (basic_block)place_p;
rtx seq, var, zero_init, insn;
unsigned i;
@@ -2088,7 +2088,7 @@ insert_var_expansion_initialization (void **slot, void *place_p)
static int
combine_var_copies_in_loop_exit (void **slot, void *place_p)
{
- struct var_to_expand *ve = *slot;
+ struct var_to_expand *ve = (struct var_to_expand *) *slot;
basic_block place = (basic_block)place_p;
rtx sum = ve->reg;
rtx expr, seq, var, insn;
@@ -2181,7 +2181,8 @@ apply_opt_in_copies (struct opt_info *opt_info,
/* Apply splitting iv optimization. */
if (opt_info->insns_to_split)
{
- ivts = htab_find (opt_info->insns_to_split, &ivts_templ);
+ ivts = (struct iv_to_split *)
+ htab_find (opt_info->insns_to_split, &ivts_templ);
if (ivts)
{
@@ -2196,7 +2197,8 @@ apply_opt_in_copies (struct opt_info *opt_info,
/* Apply variable expansion optimization. */
if (unrolling && opt_info->insns_with_var_to_expand)
{
- ves = htab_find (opt_info->insns_with_var_to_expand, &ve_templ);
+ ves = (struct var_to_expand *)
+ htab_find (opt_info->insns_with_var_to_expand, &ve_templ);
if (ves)
{
gcc_assert (GET_CODE (PATTERN (insn))
@@ -2246,7 +2248,8 @@ apply_opt_in_copies (struct opt_info *opt_info,
ivts_templ.insn = orig_insn;
if (opt_info->insns_to_split)
{
- ivts = htab_find (opt_info->insns_to_split, &ivts_templ);
+ ivts = (struct iv_to_split *)
+ htab_find (opt_info->insns_to_split, &ivts_templ);
if (ivts)
{
if (!delta)
@@ -2266,7 +2269,7 @@ apply_opt_in_copies (struct opt_info *opt_info,
static int
release_var_copies (void **slot, void *data ATTRIBUTE_UNUSED)
{
- struct var_to_expand *ve = *slot;
+ struct var_to_expand *ve = (struct var_to_expand *) *slot;
VEC_free (rtx, heap, ve->var_expansions);
diff --git a/gcc/matrix-reorg.c b/gcc/matrix-reorg.c
index 50ac7e8..33bb0b4 100644
--- a/gcc/matrix-reorg.c
+++ b/gcc/matrix-reorg.c
@@ -358,7 +358,8 @@ static bool check_transpose_p;
static hashval_t
mat_acc_phi_hash (const void *p)
{
- const struct matrix_access_phi_node *ma_phi = p;
+ const struct matrix_access_phi_node *const ma_phi =
+ (const struct matrix_access_phi_node *) p;
return htab_hash_pointer (ma_phi->phi);
}
@@ -368,8 +369,10 @@ mat_acc_phi_hash (const void *p)
static int
mat_acc_phi_eq (const void *p1, const void *p2)
{
- const struct matrix_access_phi_node *phi1 = p1;
- const struct matrix_access_phi_node *phi2 = p2;
+ const struct matrix_access_phi_node *const phi1 =
+ (const struct matrix_access_phi_node *) p1;
+ const struct matrix_access_phi_node *const phi2 =
+ (const struct matrix_access_phi_node *) p2;
if (phi1->phi == phi2->phi)
return 1;
@@ -397,8 +400,8 @@ mtt_info_hash (const void *mtt)
static int
mtt_info_eq (const void *mtt1, const void *mtt2)
{
- const struct matrix_info *i1 = mtt1;
- const struct matrix_info *i2 = mtt2;
+ const struct matrix_info *const i1 = (const struct matrix_info *) mtt1;
+ const struct matrix_info *const i2 = (const struct matrix_info *) mtt2;
if (i1->decl == i2->decl)
return true;
@@ -521,7 +524,7 @@ analyze_matrix_decl (tree var_decl)
/* Check to see if this pointer is already in there. */
tmpmi.decl = var_decl;
- mi = htab_find (matrices_to_reorg, &tmpmi);
+ mi = (struct matrix_info *) htab_find (matrices_to_reorg, &tmpmi);
if (mi)
return NULL;
@@ -738,13 +741,13 @@ add_allocation_site (struct matrix_info *mi, tree stmt, int level)
calls like calloc and realloc. */
if (!mi->malloc_for_level)
{
- mi->malloc_for_level = xcalloc (level + 1, sizeof (tree));
+ mi->malloc_for_level = XCNEWVEC (tree, level + 1);
mi->max_malloced_level = level + 1;
}
else if (mi->max_malloced_level <= level)
{
mi->malloc_for_level
- = xrealloc (mi->malloc_for_level, (level + 1) * sizeof (tree));
+ = XRESIZEVEC (tree, mi->malloc_for_level, level + 1);
/* Zero the newly allocated items. */
memset (&(mi->malloc_for_level[mi->max_malloced_level + 1]),
@@ -879,7 +882,7 @@ analyze_matrix_allocation_site (struct matrix_info *mi, tree stmt,
static int
analyze_transpose (void **slot, void *data ATTRIBUTE_UNUSED)
{
- struct matrix_info *mi = *slot;
+ struct matrix_info *mi = (struct matrix_info *) *slot;
int min_escape_l = mi->min_indirect_level_escape;
struct loop *loop;
affine_iv iv;
@@ -1079,7 +1082,8 @@ analyze_accesses_for_phi_node (struct matrix_info *mi, tree use_stmt,
struct matrix_access_phi_node tmp_maphi, *maphi, **pmaphi;
tmp_maphi.phi = use_stmt;
- if ((maphi = htab_find (htab_mat_acc_phi_nodes, &tmp_maphi)))
+ if ((maphi = (struct matrix_access_phi_node *)
+ htab_find (htab_mat_acc_phi_nodes, &tmp_maphi)))
{
if (maphi->indirection_level == current_indirect_level)
return;
@@ -1358,7 +1362,7 @@ check_var_notmodified_p (tree * tp, int *walk_subtrees, void *data)
{
basic_block bb;
tree t = *tp;
- tree fn = data;
+ tree fn = (tree) data;
block_stmt_iterator bsi;
tree stmt;
@@ -1482,7 +1486,7 @@ check_allocation_function (void **slot, void *data ATTRIBUTE_UNUSED)
int level;
block_stmt_iterator bsi;
basic_block bb_level_0;
- struct matrix_info *mi = *slot;
+ struct matrix_info *mi = (struct matrix_info *) *slot;
sbitmap visited;
if (!mi->malloc_for_level)
@@ -1587,7 +1591,8 @@ find_sites_in_func (bool record)
&& TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 0)) == VAR_DECL)
{
tmpmi.decl = GIMPLE_STMT_OPERAND (stmt, 0);
- if ((mi = htab_find (matrices_to_reorg, &tmpmi)))
+ if ((mi = (struct matrix_info *) htab_find (matrices_to_reorg,
+ &tmpmi)))
{
sbitmap_zero (visited_stmts_1);
analyze_matrix_allocation_site (mi, stmt, 0, visited_stmts_1);
@@ -1598,7 +1603,8 @@ find_sites_in_func (bool record)
&& TREE_CODE (GIMPLE_STMT_OPERAND (stmt, 1)) == VAR_DECL)
{
tmpmi.decl = GIMPLE_STMT_OPERAND (stmt, 1);
- if ((mi = htab_find (matrices_to_reorg, &tmpmi)))
+ if ((mi = (struct matrix_info *) htab_find (matrices_to_reorg,
+ &tmpmi)))
{
sbitmap_zero (visited_stmts_1);
analyze_matrix_accesses (mi,
@@ -1645,7 +1651,7 @@ record_all_accesses_in_func (void)
chain for this SSA_VAR and check for escapes or apply the
flattening. */
tmpmi.decl = rhs;
- if ((mi = htab_find (matrices_to_reorg, &tmpmi)))
+ if ((mi = (struct matrix_info *) htab_find (matrices_to_reorg, &tmpmi)))
{
/* This variable will track the visited PHI nodes, so we can limit
its size to the maximum number of SSA names. */
@@ -1714,7 +1720,7 @@ static int
transform_access_sites (void **slot, void *data ATTRIBUTE_UNUSED)
{
block_stmt_iterator bsi;
- struct matrix_info *mi = *slot;
+ struct matrix_info *mi = (struct matrix_info *) *slot;
int min_escape_l = mi->min_indirect_level_escape;
struct access_site_info *acc_info;
int i;
@@ -1942,7 +1948,7 @@ transform_allocation_sites (void **slot, void *data ATTRIBUTE_UNUSED)
int min_escape_l;
int id;
- mi = *slot;
+ mi = (struct matrix_info *) *slot;
min_escape_l = mi->min_indirect_level_escape;
@@ -2184,7 +2190,7 @@ transform_allocation_sites (void **slot, void *data ATTRIBUTE_UNUSED)
static int
dump_matrix_reorg_analysis (void **slot, void *data ATTRIBUTE_UNUSED)
{
- struct matrix_info *mi = *slot;
+ struct matrix_info *mi = (struct matrix_info *) *slot;
if (!dump_file)
return 1;
diff --git a/gcc/omp-low.c b/gcc/omp-low.c
index db5f858..e26ebbc 100644
--- a/gcc/omp-low.c
+++ b/gcc/omp-low.c
@@ -1097,7 +1097,7 @@ debug_all_omp_regions (void)
struct omp_region *
new_omp_region (basic_block bb, enum tree_code type, struct omp_region *parent)
{
- struct omp_region *region = xcalloc (1, sizeof (*region));
+ struct omp_region *region = XCNEW (struct omp_region);
region->outer = parent;
region->entry = bb;
@@ -1493,7 +1493,7 @@ create_omp_child_function_name (bool task_copy)
const char *suffix;
suffix = task_copy ? "_omp_cpyfn" : "_omp_fn";
- prefix = alloca (len + strlen (suffix) + 1);
+ prefix = XALLOCAVEC (char, len + strlen (suffix) + 1);
memcpy (prefix, IDENTIFIER_POINTER (name), len);
strcpy (prefix + len, suffix);
#ifndef NO_DOT_IN_LABEL
@@ -1853,8 +1853,8 @@ check_omp_nesting_restrictions (tree t, omp_context *ctx)
static tree
scan_omp_1 (tree *tp, int *walk_subtrees, void *data)
{
- struct walk_stmt_info *wi = data;
- omp_context *ctx = wi->info;
+ struct walk_stmt_info *wi = (struct walk_stmt_info *) data;
+ omp_context *ctx = (omp_context *) wi->info;
tree t = *tp;
if (EXPR_HAS_LOCATION (t))
@@ -5800,8 +5800,8 @@ lower_omp_for (tree *stmt_p, omp_context *ctx)
static tree
check_combined_parallel (tree *tp, int *walk_subtrees, void *data)
{
- struct walk_stmt_info *wi = data;
- int *info = wi->info;
+ struct walk_stmt_info *wi = (struct walk_stmt_info *) data;
+ int *info = (int *) wi->info;
*walk_subtrees = 0;
switch (TREE_CODE (*tp))
@@ -6194,7 +6194,7 @@ static tree
lower_omp_2 (tree *tp, int *walk_subtrees, void *data)
{
tree t = *tp;
- omp_context *ctx = data;
+ omp_context *ctx = (omp_context *) data;
/* Any variable with DECL_VALUE_EXPR needs to be regimplified. */
if (TREE_CODE (t) == VAR_DECL
@@ -6470,7 +6470,7 @@ diagnose_sb_0 (tree *stmt_p, tree branch_ctx, tree label_ctx)
static tree
diagnose_sb_1 (tree *tp, int *walk_subtrees, void *data)
{
- struct walk_stmt_info *wi = data;
+ struct walk_stmt_info *wi = (struct walk_stmt_info *) data;
tree context = (tree) wi->info;
tree inner_context;
tree t = *tp;
@@ -6532,7 +6532,7 @@ diagnose_sb_1 (tree *tp, int *walk_subtrees, void *data)
static tree
diagnose_sb_2 (tree *tp, int *walk_subtrees, void *data)
{
- struct walk_stmt_info *wi = data;
+ struct walk_stmt_info *wi = (struct walk_stmt_info *) data;
tree context = (tree) wi->info;
splay_tree_node n;
tree t = *tp;
diff --git a/gcc/optabs.c b/gcc/optabs.c
index 558a708..61c810e 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -3801,7 +3801,7 @@ struct no_conflict_data
static void
no_conflict_move_test (rtx dest, const_rtx set, void *p0)
{
- struct no_conflict_data *p= p0;
+ struct no_conflict_data *p= (struct no_conflict_data *) p0;
/* If this inns directly contributes to setting the target, it must stay. */
if (reg_overlap_mentioned_p (p->target, dest))
@@ -5463,7 +5463,7 @@ gen_libfunc (optab optable, const char *opname, int suffix, enum machine_mode mo
unsigned opname_len = strlen (opname);
const char *mname = GET_MODE_NAME (mode);
unsigned mname_len = strlen (mname);
- char *libfunc_name = alloca (2 + opname_len + mname_len + 1 + 1);
+ char *libfunc_name = XALLOCAVEC (char, 2 + opname_len + mname_len + 1 + 1);
char *p;
const char *q;
@@ -5511,7 +5511,7 @@ gen_fp_libfunc (optab optable, const char *opname, char suffix,
gen_libfunc (optable, opname, suffix, mode);
if (DECIMAL_FLOAT_MODE_P (mode))
{
- dec_opname = alloca (sizeof (DECIMAL_PREFIX) + strlen (opname));
+ dec_opname = XALLOCAVEC (char, sizeof (DECIMAL_PREFIX) + strlen (opname));
/* For BID support, change the name to have either a bid_ or dpd_ prefix
depending on the low level floating format used. */
memcpy (dec_opname, DECIMAL_PREFIX, sizeof (DECIMAL_PREFIX) - 1);
@@ -5579,7 +5579,7 @@ gen_intv_fp_libfunc (optab optable, const char *name, char suffix,
if (GET_MODE_CLASS (mode) == MODE_INT)
{
int len = strlen (name);
- char *v_name = alloca (len + 2);
+ char *v_name = XALLOCAVEC (char, len + 2);
strcpy (v_name, name);
v_name[len] = 'v';
v_name[len + 1] = 0;
@@ -5683,13 +5683,13 @@ gen_interclass_conv_libfunc (convert_optab tab,
mname_len = strlen (GET_MODE_NAME (tmode)) + strlen (GET_MODE_NAME (fmode));
- nondec_name = alloca (2 + opname_len + mname_len + 1 + 1);
+ nondec_name = XALLOCAVEC (char, 2 + opname_len + mname_len + 1 + 1);
nondec_name[0] = '_';
nondec_name[1] = '_';
memcpy (&nondec_name[2], opname, opname_len);
nondec_suffix = nondec_name + opname_len + 2;
- dec_name = alloca (2 + dec_len + opname_len + mname_len + 1 + 1);
+ dec_name = XALLOCAVEC (char, 2 + dec_len + opname_len + mname_len + 1 + 1);
dec_name[0] = '_';
dec_name[1] = '_';
memcpy (&dec_name[2], DECIMAL_PREFIX, dec_len);
@@ -5808,13 +5808,13 @@ gen_intraclass_conv_libfunc (convert_optab tab, const char *opname,
mname_len = strlen (GET_MODE_NAME (tmode)) + strlen (GET_MODE_NAME (fmode));
- nondec_name = alloca (2 + opname_len + mname_len + 1 + 1);
+ nondec_name = XALLOCAVEC (char, 2 + opname_len + mname_len + 1 + 1);
nondec_name[0] = '_';
nondec_name[1] = '_';
memcpy (&nondec_name[2], opname, opname_len);
nondec_suffix = nondec_name + opname_len + 2;
- dec_name = alloca (2 + dec_len + opname_len + mname_len + 1 + 1);
+ dec_name = XALLOCAVEC (char, 2 + dec_len + opname_len + mname_len + 1 + 1);
dec_name[0] = '_';
dec_name[1] = '_';
memcpy (&dec_name[2], DECIMAL_PREFIX, dec_len);
@@ -6026,7 +6026,7 @@ set_optab_libfunc (optab optable, enum machine_mode mode, const char *name)
val = 0;
slot = (struct libfunc_entry **) htab_find_slot (libfunc_hash, &e, INSERT);
if (*slot == NULL)
- *slot = ggc_alloc (sizeof (struct libfunc_entry));
+ *slot = GGC_NEW (struct libfunc_entry);
(*slot)->optab = (size_t) (optable - &optab_table[0]);
(*slot)->mode1 = mode;
(*slot)->mode2 = VOIDmode;
@@ -6053,7 +6053,7 @@ set_conv_libfunc (convert_optab optable, enum machine_mode tmode,
val = 0;
slot = (struct libfunc_entry **) htab_find_slot (libfunc_hash, &e, INSERT);
if (*slot == NULL)
- *slot = ggc_alloc (sizeof (struct libfunc_entry));
+ *slot = GGC_NEW (struct libfunc_entry);
(*slot)->optab = (size_t) (optable - &convert_optab_table[0]);
(*slot)->mode1 = tmode;
(*slot)->mode2 = fmode;
diff --git a/gcc/opts-common.c b/gcc/opts-common.c
index 5a6786d..af8e44c 100644
--- a/gcc/opts-common.c
+++ b/gcc/opts-common.c
@@ -131,8 +131,8 @@ void
prune_options (int *argcp, char ***argvp)
{
int argc = *argcp;
- int *options = xmalloc (argc * sizeof (*options));
- char **argv = xmalloc (argc * sizeof (char *));
+ int *options = XNEWVEC (int, argc);
+ char **argv = XNEWVEC (char *, argc);
int i, arg_count, need_prune = 0;
const struct cl_option *option;
size_t opt_index;
diff --git a/gcc/opts.c b/gcc/opts.c
index 6d6d380..226030b 100644
--- a/gcc/opts.c
+++ b/gcc/opts.c
@@ -651,7 +651,7 @@ static void
add_input_filename (const char *filename)
{
num_in_fnames++;
- in_fnames = xrealloc (in_fnames, num_in_fnames * sizeof (in_fnames[0]));
+ in_fnames = XRESIZEVEC (const char *, in_fnames, num_in_fnames);
in_fnames[num_in_fnames - 1] = filename;
}
@@ -1134,7 +1134,7 @@ print_filtered_help (unsigned int include_flags,
}
if (!printed)
- printed = xcalloc (1, cl_options_count);
+ printed = XCNEWVAR (char, cl_options_count);
for (i = 0; i < cl_options_count; i++)
{
@@ -2143,7 +2143,7 @@ get_option_state (int option, struct cl_option_state *state)
state->data = *(const char **) cl_options[option].flag_var;
if (state->data == 0)
state->data = "";
- state->size = strlen (state->data) + 1;
+ state->size = strlen ((const char *) state->data) + 1;
break;
}
return true;
diff --git a/gcc/params.c b/gcc/params.c
index 569ae47..2c653cf 100644
--- a/gcc/params.c
+++ b/gcc/params.c
@@ -40,8 +40,8 @@ void
add_params (const param_info params[], size_t n)
{
/* Allocate enough space for the new parameters. */
- compiler_params = xrealloc (compiler_params,
- (num_compiler_params + n) * sizeof (param_info));
+ compiler_params = XRESIZEVEC (param_info, compiler_params,
+ num_compiler_params + n);
/* Copy them into the table. */
memcpy (compiler_params + num_compiler_params,
params,
diff --git a/gcc/passes.c b/gcc/passes.c
index ce8cbb1..ba6151a 100644
--- a/gcc/passes.c
+++ b/gcc/passes.c
@@ -346,7 +346,7 @@ set_pass_for_id (int id, struct opt_pass *pass)
pass->static_pass_number = id;
if (passes_by_id_size <= id)
{
- passes_by_id = xrealloc (passes_by_id, (id + 1) * sizeof (void *));
+ passes_by_id = XRESIZEVEC (struct opt_pass *, passes_by_id, id + 1);
memset (passes_by_id + passes_by_id_size, 0,
(id + 1 - passes_by_id_size) * sizeof (void *));
passes_by_id_size = id + 1;
@@ -449,7 +449,7 @@ next_pass_1 (struct opt_pass **list, struct opt_pass *pass)
{
struct opt_pass *new;
- new = xmalloc (sizeof (*new));
+ new = XNEW (struct opt_pass);
memcpy (new, pass, sizeof (*new));
new->next = NULL;
@@ -884,7 +884,7 @@ do_per_function_toporder (void (*callback) (void *data), void *data)
else
{
gcc_assert (!order);
- order = ggc_alloc (sizeof (*order) * cgraph_n_nodes);
+ order = GGC_NEWVEC (struct cgraph_node *, cgraph_n_nodes);
nnodes = cgraph_postorder (order);
for (i = nnodes - 1; i >= 0; i--)
{
@@ -1150,7 +1150,7 @@ pass_fini_dump_file (struct opt_pass *pass)
static void
update_properties_after_pass (void *data)
{
- struct opt_pass *pass = data;
+ struct opt_pass *pass = (struct opt_pass *) data;
cfun->curr_properties = (cfun->curr_properties | pass->properties_provided)
& ~pass->properties_destroyed;
}
diff --git a/gcc/postreload.c b/gcc/postreload.c
index 527bd8b..dcac71b 100644
--- a/gcc/postreload.c
+++ b/gcc/postreload.c
@@ -394,9 +394,9 @@ reload_cse_simplify_operands (rtx insn, rtx testreg)
if (! constrain_operands (1))
fatal_insn_not_found (insn);
- alternative_reject = alloca (recog_data.n_alternatives * sizeof (int));
- alternative_nregs = alloca (recog_data.n_alternatives * sizeof (int));
- alternative_order = alloca (recog_data.n_alternatives * sizeof (int));
+ alternative_reject = XALLOCAVEC (int, recog_data.n_alternatives);
+ alternative_nregs = XALLOCAVEC (int, recog_data.n_alternatives);
+ alternative_order = XALLOCAVEC (int, recog_data.n_alternatives);
memset (alternative_reject, 0, recog_data.n_alternatives * sizeof (int));
memset (alternative_nregs, 0, recog_data.n_alternatives * sizeof (int));
@@ -487,7 +487,7 @@ reload_cse_simplify_operands (rtx insn, rtx testreg)
int regno;
const char *p;
- op_alt_regno[i] = alloca (recog_data.n_alternatives * sizeof (int));
+ op_alt_regno[i] = XALLOCAVEC (int, recog_data.n_alternatives);
for (j = 0; j < recog_data.n_alternatives; j++)
op_alt_regno[i][j] = -1;
diff --git a/gcc/predict.c b/gcc/predict.c
index 2d6faf3..ca7f944 100644
--- a/gcc/predict.c
+++ b/gcc/predict.c
@@ -211,7 +211,7 @@ tree_predicted_by_p (const_basic_block bb, enum br_predictor predictor)
if (!preds)
return false;
- for (i = *preds; i; i = i->ep_next)
+ for (i = (struct edge_prediction *) *preds; i; i = i->ep_next)
if (i->ep_predictor == predictor)
return true;
return false;
@@ -316,7 +316,7 @@ tree_predict_edge (edge e, enum br_predictor predictor, int probability)
struct edge_prediction *i = XNEW (struct edge_prediction);
void **preds = pointer_map_insert (bb_predictions, e->src);
- i->ep_next = *preds;
+ i->ep_next = (struct edge_prediction *) *preds;
*preds = i;
i->ep_probability = probability;
i->ep_predictor = predictor;
@@ -366,7 +366,7 @@ clear_bb_predictions (basic_block bb)
if (!preds)
return;
- for (pred = *preds; pred; pred = next)
+ for (pred = (struct edge_prediction *) *preds; pred; pred = next)
{
next = pred->ep_next;
free (pred);
@@ -638,7 +638,7 @@ combine_predictions_for_bb (basic_block bb)
{
/* We implement "first match" heuristics and use probability guessed
by predictor with smallest index. */
- for (pred = *preds; pred; pred = pred->ep_next)
+ for (pred = (struct edge_prediction *) *preds; pred; pred = pred->ep_next)
{
int predictor = pred->ep_predictor;
int probability = pred->ep_probability;
@@ -688,7 +688,7 @@ combine_predictions_for_bb (basic_block bb)
if (preds)
{
- for (pred = *preds; pred; pred = pred->ep_next)
+ for (pred = (struct edge_prediction *) *preds; pred; pred = pred->ep_next)
{
int predictor = pred->ep_predictor;
int probability = pred->ep_probability;