public inbox for libabigail@sourceware.org
 help / color / mirror / Atom feed
* [Bug default/28073] New: [libabigail] Incorrect size for bitfields
@ 2021-07-10 19:27 david.marchand at redhat dot com
  2021-12-06 13:54 ` [Bug default/28073] " dodji at redhat dot com
  0 siblings, 1 reply; 2+ messages in thread
From: david.marchand at redhat dot com @ 2021-07-10 19:27 UTC (permalink / raw)
  To: libabigail

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

            Bug ID: 28073
           Summary: [libabigail] Incorrect size for bitfields
           Product: libabigail
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: default
          Assignee: dodji at redhat dot com
          Reporter: david.marchand at redhat dot com
                CC: libabigail at sourceware dot org
  Target Milestone: ---

Created attachment 13555
  --> https://sourceware.org/bugzilla/attachment.cgi?id=13555&action=edit
after_plop.dump

This is a continuation of #28060 with a little extension on the reproducer,
adding a other field at the end of the struct.

$ cat plop.c
#include <inttypes.h>

struct bigstruct {
        char name[128];
        uint8_t bitfield0:1
#ifndef BEFORE
                ,bitfield1:1
#endif
        ;
        uint8_t other;
};

void access_bigstruct(struct bigstruct *st)
{
#ifndef BEFORE
        st->bitfield1 = 1;
#endif
}

XML dump is attached.

As far as I can see, the bitfield0 and bitfield1 are declared with a uint8_t
type, of size 8 bits.
[...]
    <type-decl name='unsigned char' size-in-bits='8' id='type-id-5'/>
[...]
      <data-member access='public' layout-offset-in-bits='7'>
        <var-decl name='bitfield0' type-id='type-id-8' visibility='default'
filepath='/home/dmarchan/libabigail_bitfields/plop.c' line='5' column='1'/>
      </data-member>
      <data-member access='public' layout-offset-in-bits='6'>
        <var-decl name='bitfield1' type-id='type-id-8' visibility='default'
filepath='/home/dmarchan/libabigail_bitfields/plop.c' line='7' column='1'/>
      </data-member>
[...]
    <typedef-decl name='uint8_t' type-id='type-id-9'
filepath='/usr/include/bits/stdint-uintn.h' line='24' column='1'
id='type-id-8'/>
    <typedef-decl name='__uint8_t' type-id='type-id-5'
filepath='/usr/include/bits/types.h' line='38' column='1' id='type-id-9'/>
[...]


This makes it impossible to write a suppression rule based on, for example,
bitfield0 offset.
[suppress_type]
        name = bigstruct
        has_data_member_inserted_between = {offset_after(bitfield0),
offset_of(other)}

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

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

end of thread, other threads:[~2021-12-06 13:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-07-10 19:27 [Bug default/28073] New: [libabigail] Incorrect size for bitfields david.marchand at redhat dot com
2021-12-06 13:54 ` [Bug default/28073] " 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).