Bug 24407 - comment in partition_dups_1 does not match code
Summary: comment in partition_dups_1 does not match code
Status: RESOLVED WORKSFORME
Alias: None
Product: dwz
Classification: Unclassified
Component: default (show other bugs)
Version: unspecified
: P2 minor
Target Milestone: ---
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-04-01 12:36 UTC by Tom de Vries
Modified: 2019-04-01 17:21 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom de Vries 2019-04-01 12:36:33 UTC
In partition_dups_1 there's some code:
...
      if (second_phase)
        {
          dw_die_ref next;
          for (k = i; k < j; k++)
            {
              if (arr[k]->die_dup != NULL)
                continue;
              for (ref = arr[k]; ref; ref = next)
                {
                  dw_cu_ref refcu = die_cu (ref);
                  next = ref->die_nextdup;
                  ref->die_dup = NULL;
                  ref->die_nextdup = NULL;
                  ref->die_remove = 0;
                  /* If there are dups within a single CU
                     (arguably a bug in the DWARF producer),
                     keep them linked together, but don't link
                     DIEs across different CUs.  */
                  while (next && refcu == die_cu (next))
                    {
                      dw_die_ref cur = next;
                      next = cur->die_nextdup;
                      cur->die_dup = ref;
                      cur->die_nextdup = ref->die_nextdup;
                      ref->die_nextdup = cur;
                    }
                }
            }
        }
...

If we have DIEs linked across 2 different CUs, indeed this code breaks the link.

But if we have DIES linked across 3 different CUs, then this code breaks the link between the first and the second, but not between the second and the third.
Comment 1 Tom de Vries 2019-04-01 17:21:52 UTC
Sorry, after more debugging, I realize I misunderstood the code.

[ Perhaps factoring out the two inner loops into an unlinks_dups function would make things a bit more readable for me. ]

Marking as resolved-worksforme.