This is the mail archive of the
mailing list for the GCC project.
Use of stack VECs in df-scan.c:df_bb_verify
- From: Diego Novillo <dnovillo at google dot com>
- To: Daniel Berlin <dannyb at google dot com>, Ken Zadeck <zadeck at naturalbridge dot com>, gcc <gcc at gcc dot gnu dot org>
- Date: Fri, 18 May 2012 12:14:49 -0400
- Subject: Use of stack VECs in df-scan.c:df_bb_verify
This is rather old code for you folks, but I'm not quite sure how to
deal with this issue.
I've converted vec.[hc] to C++ and this meant some subtle changes to how
VEC(T,stack) works. We no longer need all those macro expansions.
This means that the allocation function for vectors can detect when a
stack vector is initially allocated on the heap. This happens when the
vector is implicitly allocated when the first element is pushed (and the
vector is nil).
This was causing an ICE in df_bb_verify() because of this code:
collection_rec.def_vec = VEC_alloc (df_ref, stack, 128);
collection_rec.use_vec = VEC_alloc (df_ref, stack, 32);
collection_rec.eq_use_vec = VEC_alloc (df_ref, stack, 32);
collection_rec.mw_vec = VEC_alloc (df_mw_hardreg_ptr, stack, 32);
/* Scan the block, one insn at a time, from beginning to end. */
FOR_BB_INSNS_REVERSE (bb, insn)
if (!INSN_P (insn))
df_insn_refs_verify (&collection_rec, bb, insn, true);
Note that we initially allocate the various vectors on the stack, but
then the FOR_BB_INSNS_REVERSE loop explicitly deallocates them. The
next time df_insns_ref_verify tries to push something on these VECs, the
pushing routine will try to do an initial allocation on the heap, which
causes an ICE.
I *think* what you meant in that loop is to clear COLLECTION_REC? Or
should we clear it and reallocate the vectors? I am currently running
with the call to df_free_collection_rec() taken out, but I'm not sure if
that's the right thing here.