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/30048] New: incorrect qualifiers within compound types
Date: Wed, 25 Jan 2023 09:40:33 +0000	[thread overview]
Message-ID: <bug-30048-9487@http.sourceware.org/bugzilla/> (raw)

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

            Bug ID: 30048
           Summary: incorrect qualifiers within compound types
           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: ---

This appears to be some kind of equality or canonicalisation issue.

The types of the f06 and f07 members should be the same in the two ABIs
extracted. Here I've compiled with GCC (and checked the DWARF independently
anyway).

==> small.c <==
struct S {
  int (*f01)(int);
  int (*f02)(const int*);
  int (*f03)(int* const);
  int (*f04)(int* restrict);
  int (*f05)(const int* restrict);
  int (*f06)(int* restrict const);
  int (*f07)(int* const restrict);
};

struct S s;

==> smaller.c <==
struct S {
  int (*f06)(int* restrict const);
  int (*f07)(int* const restrict);
};

struct S s;

$ abidw --no-show-locs --no-comp-dir-path --no-corpus-path small.o
<abi-corpus version='2.1' architecture='elf-amd-x86_64'>
  <elf-variable-symbols>
    <elf-symbol name='s' size='56' type='object-type' binding='global-binding'
visibility='default-visibility' is-defined='yes'/>
  </elf-variable-symbols>
  <abi-instr address-size='64' path='/tmp/small.c' language='LANG_C11'>
    <type-decl name='int' size-in-bits='32' id='type-id-1'/>
    <class-decl name='S' size-in-bits='448' is-struct='yes'
visibility='default' id='type-id-2'>
      <data-member access='public' layout-offset-in-bits='0'>
        <var-decl name='f01' type-id='type-id-3' visibility='default'/>
      </data-member>
      <data-member access='public' layout-offset-in-bits='64'>
        <var-decl name='f02' type-id='type-id-4' visibility='default'/>
      </data-member>
      <data-member access='public' layout-offset-in-bits='128'>
        <var-decl name='f03' type-id='type-id-5' visibility='default'/>
      </data-member>
      <data-member access='public' layout-offset-in-bits='192'>
        <var-decl name='f04' type-id='type-id-6' visibility='default'/>
      </data-member>
      <data-member access='public' layout-offset-in-bits='256'>
        <var-decl name='f05' type-id='type-id-7' visibility='default'/>
      </data-member>
      <data-member access='public' layout-offset-in-bits='320'>
        <var-decl name='f06' type-id='type-id-7' visibility='default'/>
      </data-member>
      <data-member access='public' layout-offset-in-bits='384'>
        <var-decl name='f07' type-id='type-id-7' visibility='default'/>
      </data-member>
    </class-decl>
    <qualified-type-def type-id='type-id-1' const='yes' id='type-id-8'/>
    <pointer-type-def type-id='type-id-8' size-in-bits='64' id='type-id-9'/>
    <qualified-type-def type-id='type-id-9' restrict='yes' id='type-id-10'/>
    <pointer-type-def type-id='type-id-11' size-in-bits='64' id='type-id-7'/>
    <pointer-type-def type-id='type-id-12' size-in-bits='64' id='type-id-4'/>
    <pointer-type-def type-id='type-id-13' size-in-bits='64' id='type-id-3'/>
    <pointer-type-def type-id='type-id-14' size-in-bits='64' id='type-id-5'/>
    <pointer-type-def type-id='type-id-15' size-in-bits='64' id='type-id-6'/>
    <pointer-type-def type-id='type-id-1' size-in-bits='64' id='type-id-16'/>
    <qualified-type-def type-id='type-id-16' const='yes' id='type-id-17'/>
    <qualified-type-def type-id='type-id-16' restrict='yes' id='type-id-18'/>
    <var-decl name='s' type-id='type-id-2' mangled-name='s'
visibility='default' elf-symbol-id='s'/>
    <function-type size-in-bits='64' id='type-id-11'>
      <parameter type-id='type-id-10'/>
      <return type-id='type-id-1'/>
    </function-type>
    <function-type size-in-bits='64' id='type-id-12'>
      <parameter type-id='type-id-9'/>
      <return type-id='type-id-1'/>
    </function-type>
    <function-type size-in-bits='64' id='type-id-13'>
      <parameter type-id='type-id-1'/>
      <return type-id='type-id-1'/>
    </function-type>
    <function-type size-in-bits='64' id='type-id-14'>
      <parameter type-id='type-id-17'/>
      <return type-id='type-id-1'/>
    </function-type>
    <function-type size-in-bits='64' id='type-id-15'>
      <parameter type-id='type-id-18'/>
      <return type-id='type-id-1'/>
    </function-type>
  </abi-instr>
</abi-corpus>

abidw --no-show-locs --no-comp-dir-path --no-corpus-path smaller.o
<abi-corpus version='2.1' architecture='elf-amd-x86_64'>
  <elf-variable-symbols>
    <elf-symbol name='s' size='16' type='object-type' binding='global-binding'
visibility='default-visibility' is-defined='yes'/>
  </elf-variable-symbols>
  <abi-instr address-size='64' path='/tmp/smaller.c' language='LANG_C11'>
    <type-decl name='int' size-in-bits='32' id='type-id-1'/>
    <class-decl name='S' size-in-bits='128' is-struct='yes'
visibility='default' id='type-id-2'>
      <data-member access='public' layout-offset-in-bits='0'>
        <var-decl name='f06' type-id='type-id-3' visibility='default'/>
      </data-member>
      <data-member access='public' layout-offset-in-bits='64'>
        <var-decl name='f07' type-id='type-id-3' visibility='default'/>
      </data-member>
    </class-decl>
    <pointer-type-def type-id='type-id-4' size-in-bits='64' id='type-id-3'/>
    <pointer-type-def type-id='type-id-1' size-in-bits='64' id='type-id-5'/>
    <qualified-type-def type-id='type-id-5' const='yes' id='type-id-6'/>
    <qualified-type-def type-id='type-id-6' restrict='yes' id='type-id-7'/>
    <var-decl name='s' type-id='type-id-2' mangled-name='s'
visibility='default' elf-symbol-id='s'/>
    <function-type size-in-bits='64' id='type-id-4'>
      <parameter type-id='type-id-7'/>
      <return type-id='type-id-1'/>
    </function-type>
  </abi-instr>
</abi-corpus>

abidiff reports (whether directly on the .o or the .xml):

        type of 'int (restrict int* const)* f06' changed:
          in pointed to type 'function type int (restrict int* const)':
            parameter 1 of type 'restrict int* const' changed:
              'restrict int* const' changed to 'const int* restrict'

but fails to say the same thing about f07.

abidiff --leaf-changes-only doesn't mention the type diffs at all.

This might be up to 3 different issues (or there could be fewer root causes):

- DWARF reader / canonicalisation getting some types wrong or confused
- abidiff should also report that f07's type has changed, even if it has
changed in exactly the same way
- abidiff --leaf-changes-only should report that f06 and f07 types have
changed, as well as their offsets

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

             reply	other threads:[~2023-01-25  9:40 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-25  9:40 gprocida at google dot com [this message]
2023-01-25  9:57 ` [Bug default/30048] " gprocida at google dot com
2023-01-27  1:10 ` woodard at redhat dot com
2023-01-27 10:05 ` gprocida at google dot com
2023-01-27 10:10 ` gprocida at google dot com
2023-02-03  0:11 ` dodji at redhat dot com
2023-02-07 17:37 ` dodji at redhat dot com
2023-02-08 13:08 ` gprocida at google dot com
2023-02-10 12:50   ` Dodji Seketeli
2023-02-10 12:50 ` dodji at seketeli dot org
2023-02-10 12:50 ` 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-30048-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).