public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
From: "gprocida at google dot com" <sourceware-bugzilla@sourceware.org>
To: libabigail@sourceware.org
Subject: [Bug default/29443] New: abidw loses declarations of global variables having the same name and type as a member of an anonymous struct
Date: Wed, 03 Aug 2022 16:44:57 +0000	[thread overview]
Message-ID: <bug-29443-9487@http.sourceware.org/bugzilla/> (raw)

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

            Bug ID: 29443
           Summary: abidw loses declarations of global variables having
                    the same name and type as a member of an anonymous
                    struct
           Product: libabigail
           Version: unspecified
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: default
          Assignee: dodji at redhat dot com
          Reporter: gprocida at google dot com
                CC: libabigail at sourceware dot org
  Target Milestone: ---

Hi Dodji.

Here is a test case we reproduced at current master:
df28c220976f41620b0bd7b22000815e11f66b75

Consider this small example:

== missing_xx.cc ==
struct A {
  struct {
    int xx;
  };
};

struct A a;
int xx;

Compiled with either g++ 11.3.0 or clang++ 13.0.1
abidw --no-show-locs --no-comp-dir-path --type-id-style hash
produces XML that has the elf-symbol xx, but no var-decl:

<abi-corpus version='2.1' path='missing_xx.o' architecture='elf-amd-x86_64'>
  <elf-variable-symbols>
    <elf-symbol name='a' size='4' type='object-type' binding='global-binding'
visibility='default-visibility' is-defined='yes'/>
    <elf-symbol name='xx' size='4' type='object-type' binding='global-binding'
visibility='default-visibility' is-defined='yes'/>
  </elf-variable-symbols>
  <abi-instr address-size='64' path='missing_xx.cc'
language='LANG_C_plus_plus_14'>
    <type-decl name='int' size-in-bits='32' id='95e97e5e'/>
    <class-decl name='A' size-in-bits='32' is-struct='yes' visibility='default'
id='3ed987a4'>
      <member-type access='public'>
        <class-decl name='__anonymous_struct__' size-in-bits='32'
is-struct='yes' is-anonymous='yes' visibility='default' id='e7f43f72'>
          <data-member access='public' layout-offset-in-bits='0'>
            <var-decl name='xx' type-id='95e97e5e' visibility='default'/>
          </data-member>
        </class-decl>
      </member-type>
      <data-member access='public' layout-offset-in-bits='0'>
        <var-decl name='' type-id='e7f43f72' visibility='default'/>
      </data-member>
    </class-decl>
    <var-decl name='a' type-id='3ed987a4' mangled-name='a' visibility='default'
elf-symbol-id='a'/>
  </abi-instr>
</abi-corpus>

The problem goes away if the anonymous struct is removed or the type differs:

struct A {
  int xx;
};

or

struct A {
  struct {
    char xx;
  };
};

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

             reply	other threads:[~2022-08-03 16:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-03 16:44 gprocida at google dot com [this message]
2022-09-19 14:58 ` [Bug default/29443] " dodji at redhat dot com
2022-09-20  7:56 ` dodji at redhat dot com

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-29443-9487@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=libabigail@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).