public inbox for dwz@sourceware.org
 help / color / mirror / Atom feed
* [Bug default/27562] New: [dwz] Verify that conditional fields of struct dw_die are only accessed when available
@ 2021-03-11 14:07 vries at gcc dot gnu.org
  2021-03-11 14:07 ` [Bug default/27562] " vries at gcc dot gnu.org
  0 siblings, 1 reply; 2+ messages in thread
From: vries at gcc dot gnu.org @ 2021-03-11 14:07 UTC (permalink / raw)
  To: dwz

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

            Bug ID: 27562
           Summary: [dwz] Verify that conditional fields of struct dw_die
                    are only accessed when available
           Product: dwz
           Version: unspecified
            Status: NEW
          Severity: enhancement
          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: ---

The fields until die_parent in struct dw_die are available unconditionally.

But after die_parent, some are only available if die_collapsed_child == 0, and
others only if die_toplevel == 1.

We need to be able to instrument accesses to the conditionally available
fields, such that it's checked whether the field is indeed available.

F.i. something like this:
...
diff --git a/dwz.c b/dwz.c
index 5975cc7..5f8db49 100644
--- a/dwz.c
+++ b/dwz.c
@@ -1175,6 +1175,22 @@ struct dw_die
   dw_die_ref die_nextdup;
 };

+static inline dw_die_ref FORCE_INLINE
+get_die_nextdup (dw_die_ref die)
+{
+  assert (die->die_toplevel);
+  return die->die_nextdup;
+}
+
+static inline void FORCE_INLINE
+set_die_nextdup (dw_die_ref die, dw_die_ref val)
+{
+  assert (die->die_toplevel);
+  die->die_nextdup = val;
+}
+
+#define die_nextdup poisoned_die_nextdup
+
 #include "iterators.h"

 /* Return CU structure pointer for a DIE.  In order to save memory,
@@ -4771,7 +4787,7 @@ die_eq_1 (dw_cu_ref cu1, dw_cu_ref cu2,
       if (!die2->die_op_type_referenced)
        die2->die_remove = 1;
       obstack_ptr_grow (&ob, die2);
-      if (likely (die2->die_nextdup == NULL))
+      if (likely (get_die_nextdup (die2) == NULL))
        {
          die2->die_dup = die1;
          die2->die_nextdup = die1->die_nextdup;
...

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug default/27562] [dwz] Verify that conditional fields of struct dw_die are only accessed when available
  2021-03-11 14:07 [Bug default/27562] New: [dwz] Verify that conditional fields of struct dw_die are only accessed when available vries at gcc dot gnu.org
@ 2021-03-11 14:07 ` vries at gcc dot gnu.org
  0 siblings, 0 replies; 2+ messages in thread
From: vries at gcc dot gnu.org @ 2021-03-11 14:07 UTC (permalink / raw)
  To: dwz

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

Tom de Vries <vries at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Blocks|                            |27561


Referenced Bugs:

https://sourceware.org/bugzilla/show_bug.cgi?id=27561
[Bug 27561] [dwz] low-mem odr
-- 
You are receiving this mail because:
You are on the CC list for the bug.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-03-11 14:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-11 14:07 [Bug default/27562] New: [dwz] Verify that conditional fields of struct dw_die are only accessed when available vries at gcc dot gnu.org
2021-03-11 14:07 ` [Bug default/27562] " vries at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).