[tree-ssa] Mainline merge as of 2004-02-11
Diego Novillo
dnovillo@redhat.com
Fri Feb 13 13:20:00 GMT 2004
This merge brought in ggc_free, exposing a bug in the PHI node
management code. We cannot use ggc_realloc and keep using the old
pointer (patch at the end).
It also brought a couple of new C failures from mainline.
FAIL: gcc.c-torture/execute/20040208-2.c execution
FAIL: gcc.dg/fwritable-strings-1.c (test for errors
There are two new regressions that are not in mainline. I will take a
look today:
FAIL: gcc.c-torture/execute/string-opt-5.c execution
FAIL: gcc.c-torture/execute/string-opt-5.c execution
Bootstrapped and tested on x86, ia64, x86-64 and alpha.
Diego.
* tree-phinodes.c (resize_phi_node): Do not use ggc_realloc to
allocate a new PHI node.
--- tree-phinodes.c 2004/02/12 15:31:29 1.1
+++ tree-phinodes.c 2004/02/12 16:06:34
@@ -240,6 +240,9 @@ resize_phi_node (tree *phi, int len)
abort ();
#endif
+ /* Note that OLD_SIZE is guaranteed to be smaller than SIZE. */
+ old_size = (sizeof (struct tree_phi_node)
+ + (PHI_ARG_CAPACITY (*phi) - 1) * sizeof (struct phi_arg_d));
size = sizeof (struct tree_phi_node) + (len - 1) * sizeof (struct phi_arg_d);
if (free_phinode_count)
@@ -252,18 +255,15 @@ resize_phi_node (tree *phi, int len)
&& PHI_ARG_CAPACITY (free_phinodes[bucket]) >= len)
{
free_phinode_count--;
- old_size = (sizeof (struct tree_phi_node)
- + (PHI_ARG_CAPACITY (*phi) - 1) * sizeof (struct phi_arg_d));
new_phi = free_phinodes[bucket];
free_phinodes[bucket] = TREE_CHAIN (free_phinodes[bucket]);
- memcpy (new_phi, *phi, old_size);
#ifdef GATHER_STATISTICS
phi_nodes_reused++;
#endif
}
else
{
- new_phi = ggc_realloc (*phi, size);
+ new_phi = ggc_alloc (size);
#ifdef GATHER_STATISTICS
phi_nodes_created++;
tree_node_counts[(int) phi_kind]++;
@@ -271,6 +271,8 @@ resize_phi_node (tree *phi, int len)
#endif
}
+ memcpy (new_phi, *phi, old_size);
+
old_len = PHI_ARG_CAPACITY (new_phi);
PHI_ARG_CAPACITY (new_phi) = len;
@@ -279,7 +281,7 @@ resize_phi_node (tree *phi, int len)
PHI_ARG_DEF (new_phi, i) = NULL_TREE;
PHI_ARG_EDGE (new_phi, i) = NULL;
}
-
+
*phi = new_phi;
}
More information about the Gcc
mailing list