This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[tree-ssa] Initialize fields after resize_phi_node
- From: Zdenek Dvorak <rakdver at atrey dot karlin dot mff dot cuni dot cz>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sat, 16 Aug 2003 17:15:54 +0200
- Subject: [tree-ssa] Initialize fields after resize_phi_node
Hello,
new entries in phi node are left uninitialized, which causes crash in
garbage collector.
Zdenek
* tree.c (resize_phi_node): Initialize new entries.
Index: tree.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/tree.c,v
retrieving revision 1.263.2.44
diff -c -3 -p -r1.263.2.44 tree.c
*** tree.c 5 Aug 2003 15:17:58 -0000 1.263.2.44
--- tree.c 16 Aug 2003 15:10:33 -0000
*************** resize_phi_node (tree *phi, int len)
*** 5030,5035 ****
--- 5030,5036 ----
{
int size;
tree new_phi;
+ int i, old_len;
#ifdef ENABLE_CHECKING
if (len < PHI_ARG_CAPACITY (*phi))
*************** resize_phi_node (tree *phi, int len)
*** 5038,5044 ****
--- 5039,5052 ----
size = sizeof (struct tree_phi_node) + (len - 1) * sizeof (struct phi_arg_d);
new_phi = ggc_realloc (*phi, size);
+ old_len = PHI_ARG_CAPACITY (new_phi);
PHI_ARG_CAPACITY (new_phi) = len;
+
+ for (i = old_len; i < len; i++)
+ {
+ PHI_ARG_DEF (new_phi, i) = NULL_TREE;
+ PHI_ARG_EDGE (new_phi, i) = NULL;
+ }
*phi = new_phi;
}