public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
* [Bug default/30048] New: incorrect qualifiers within compound types
@ 2023-01-25  9:40 gprocida at google dot com
  2023-01-25  9:57 ` [Bug default/30048] " gprocida at google dot com
                   ` (8 more replies)
  0 siblings, 9 replies; 11+ messages in thread
From: gprocida at google dot com @ 2023-01-25  9:40 UTC (permalink / raw)
  To: libabigail

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.

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

end of thread, other threads:[~2023-02-10 12:50 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-25  9:40 [Bug default/30048] New: incorrect qualifiers within compound types gprocida at google dot com
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

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).