https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113475

            Bug ID: 113475
           Summary: phi_analyzer::m_tab contents leak
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: tree-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: rguenth at gcc dot gnu.org
  Target Milestone: ---

We allocate phi_group in gimple-range-phi.cc:460:

          // Try to create a group based on m_current. If a result comes back
          // with a range that isn't varying, create the group.
          phi_group cyc (m_current, init_range, mod, &m_global);
          if (!cyc.range ().varying_p ())
            {
              g = new phi_group (cyc);

which we store in

  // Now set all entries in the group to this record.
  unsigned i;
  bitmap_iterator bi;
  EXECUTE_IF_SET_IN_BITMAP (m_current, 0, i, bi)
    {
      // Can't be in more than one group.
      gcc_checking_assert (m_tab[i] == NULL);
      m_tab[i] = g;

but we dever deallocate them.  One way would be to have a dense

  vec<phi_group *> m_groups;

we put all allocated groups into and then make m_tab store an index
into that array

  vec<unsigned> m_tab;

Reply via email to