This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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);

gcc_assert (bb_info);

  /* Scan the block, one insn at a time, from beginning to end.  */
  FOR_BB_INSNS_REVERSE (bb, insn)
    {
      if (!INSN_P (insn))
        continue;
      df_insn_refs_verify (&collection_rec, bb, insn, true);
      df_free_collection_rec (&collection_rec);
    }


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.


Thanks. Diego.



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]