[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug default/24399] New: Dead code in partition_dups_1



https://sourceware.org/bugzilla/show_bug.cgi?id=24399

            Bug ID: 24399
           Summary: Dead code in partition_dups_1
           Product: dwz
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: default
          Assignee: nobody at sourceware dot org
          Reporter: vries at gcc dot gnu.org
                CC: dwz at sourceware dot org
  Target Milestone: ---

There's this clause in partition_dups_1:
...
      /* If during second_phase there are some DIEs we want to force            
         into a partial unit because they are referenced from something         
         already forced into a partial unit, but also some DIEs with            
         the same set of referrers, try to see if we can put also those         
         into the partial unit.  They can be put there only if they             
         don't refer to DIEs that won't be put into partial units.  */
      if (second_phase && force && force < j - k)
        {
...

It seems that the clause is dead. I can't trigger this abort in the test
suites:
...
diff --git a/dwz.c b/dwz.c
index 6b6a33e..c44d53d 100644
--- a/dwz.c
+++ b/dwz.c
@@ -5349,6 +5349,7 @@ partition_dups_1 (dw_die_ref *arr, size_t vec_size,
         don't refer to DIEs that won't be put into partial units.  */
       if (second_phase && force && force < j - k)
        {
+         abort ();
          /* First optimistically assume all such DIEs can be put there,
             thus mark all such DIEs as going to be included, so that
             even if one of those DIEs references another one from those
...

There's a loop just before this optimization:
...
      for (k = i; k < j; k++)
        {
          if (second_phase && arr[k]->die_ref_seen)
            force++;
          size += calc_sizes (arr[k]);
          for (ref = arr[k]->die_parent;
               ref->die_named_namespace && ref->die_dup == NULL;
               ref = ref->die_parent)
            {
              ref->die_dup = arr[k];
              namespaces++;
            }
        }
...
and it does not contain a break, so the expected end status will be k == j.

So, the condition 'force < j - k' with force >= will always evaluate to false.

-- 
You are receiving this mail because:
You are on the CC list for the bug.