public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/26525] New: DWARF5 class variables are not data members, DW_TAG_member, but DW_TAG_variable.
@ 2020-08-23 11:13 mark at klomp dot org
  2020-08-24 19:52 ` [Bug c++/26525] " tromey at sourceware dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: mark at klomp dot org @ 2020-08-23 11:13 UTC (permalink / raw)
  To: gdb-prs

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

            Bug ID: 26525
           Summary: DWARF5 class variables are not data members,
                    DW_TAG_member, but DW_TAG_variable.
           Product: gdb
           Version: unknown
            Status: NEW
          Severity: normal
          Priority: P2
         Component: c++
          Assignee: unassigned at sourceware dot org
          Reporter: mark at klomp dot org
  Target Milestone: ---

Before DWARF5 there was no description of class variables (static data members)
and gcc would emit a DW_TAG_member for the class variables as if the were
non-static data members.

DWARF5, section 5.7.7 Class Variable Entries, says they are represented by a
DW_TAG_variable.

GCC has the following in dwarf2out.c:

  /* For static data members, the declaration in the class is supposed          
     to have DW_TAG_member tag in DWARF{3,4} and we emit it for compatibility   
     also in DWARF2; the specification should still be DW_TAG_variable          
     referencing the DW_TAG_member DIE.  */
  if (declaration && class_scope_p (context_die) && dwarf_version < 5)
    var_die = new_die (DW_TAG_member, context_die, decl);
  else
    var_die = new_die (DW_TAG_variable, context_die, decl);

  if (origin != NULL)
    add_abstract_origin_attribute (var_die, origin);

This means that when building with -gdwarf-5 there no longer is a DW_TAG_member
for static data members, but an DW_TAG_variable (which can be optimized away
when not referenced). This causes the following testsuite failures:

FAIL: gdb.base/ptype-offsets.exp: ptype/o static_member
FAIL: gdb.cp/constexpr-field.exp: print y
FAIL: gdb.cp/m-static.exp: static const int initialized nowhere (print field)
FAIL: gdb.cp/m-static.exp: ptype test4.nowhere
FAIL: gdb.cp/m-static.exp: print test4.nowhere.nowhere
FAIL: gdb.cp/m-static.exp: static const int initialized nowhere (whole struct)
FAIL: gdb.cp/m-static.exp: static const int initialized in class definition
FAIL: gdb.cp/m-static.exp: static const float initialized in class definition
FAIL: gdb.cp/m-static.exp: info variable everywhere
FAIL: gdb.cp/namespace.exp: print C::OtherFileClass::cOtherFileClassVar
FAIL: gdb.cp/namespace.exp: print ::C::OtherFileClass::cOtherFileClassVar
FAIL: gdb.cp/namespace.exp: ptype ::C::OtherFileClass typedefs
FAIL: gdb.cp/namespace.exp: ptype OtherFileClass typedefs
FAIL: gdb.cp/pr-574.exp: PR gdb/574
FAIL: gdb.cp/pr9167.exp: p b
FAIL: gdb.cp/templates.exp: ptype T5<int>
FAIL: gdb.cp/templates.exp: ptype t5i

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

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

end of thread, other threads:[~2020-08-26 14:46 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-23 11:13 [Bug c++/26525] New: DWARF5 class variables are not data members, DW_TAG_member, but DW_TAG_variable mark at klomp dot org
2020-08-24 19:52 ` [Bug c++/26525] " tromey at sourceware dot org
2020-08-24 20:04 ` tromey at sourceware dot org
2020-08-24 20:22 ` mark at klomp dot org
2020-08-26 14:46 ` tromey at sourceware dot 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).