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

--- Comment #7 from Thomas Preud'homme <thopre01 at gcc dot gnu.org> ---
Hi Jakub,

First of all, thanks for beating me to it. Wanted to look at it but am fighting
strong headache since Wednesday.

Regarding the second patch, I believe it is the right approach but found
another bug in the surrounding lines which I think should be fixed in the same
patch:

          /* Absence of children might indicate an alternate root of a *chain*.
             It's ok to skip it here as the chain will be renamed when
             processing the canonical root for that chain.  */
          if (node->get_children ()->empty ())
            continue;

Comment 1: I advocate removing this block altogether.

This block prevents node from being deleted when it is a leaf. The comment is
also completely outdated and refer to when the dfs was done in the same
function as the renaming.


Comment 2: Explain why deferred freeing is necessary on top of the line adding
the node to to_free.

Something along the lines of:

/*  Defer freeing so that the process_node callback can access the parent and
children of the node being processed.  */

Best regards,

Thomas

Reply via email to