bug-binutils
[Top][All Lists]
Advanced

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

[Bug libctf/30264] New: offsets of fields in unnamed structures/unions a


From: nick.alcock at oracle dot com
Subject: [Bug libctf/30264] New: offsets of fields in unnamed structures/unions are wrong
Date: Wed, 22 Mar 2023 21:02:59 +0000

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

            Bug ID: 30264
           Summary: offsets of fields in unnamed structures/unions are
                    wrong
           Product: binutils
           Version: 2.36
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libctf
          Assignee: unassigned at sourceware dot org
          Reporter: nick.alcock at oracle dot com
  Target Milestone: ---

In e.g.

struct A
{
  int a;
  char *b;
  struct
  {
    struct
    {
      char *one;
      int two;
    };
  };
};

offsetof (struct A, one) is most unlikely to be zero; but
ctf_member_info (CTF_type_corresponding_to_A, "one") returns zero every time.

This is obviously wrong: ctf_member_info() recurses to anonymous struct
children but does not add the offset of the anonymous struct to the offset it
returns.

(A secondary but much less significant problem is that ctf_add_member() of
fields to such structures should return ECTF_DUPLICATE if the name exists in
any of the containing structures or in any underlying anonymous ones. Of course
this is only likely to happen if the compiler is buggy or something very
strange is being hand-built using the ctf_add*() functions.)

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]