c++/7432: Changed bitfield allocation strategy in g++ 3.1.1

grigory@stl.sarov.ru grigory@stl.sarov.ru
Mon Jul 29 06:26:00 GMT 2002


>Number:         7432
>Category:       c++
>Synopsis:       Changed bitfield allocation strategy in g++ 3.1.1
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jul 29 05:26:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Grigory Zagorodnev
>Release:        3.1.1
>Organization:
>Environment:
host: i686-pc-linux-gnu
build: i686-pc-linux-gnu
target: i686-pc-linux-gnu
configured with: ./configure --enable-threads
>Description:
Attached test case expecting the size of complete structure C to be 16 bytes.

  struct C {
    char c;
    int i : 67;
    char d;
  };

This is what been offered by GNU compiler for a long time. GCC 3.1.1 compiler gives another size of the structure (24 bytes).

I do not see any reason to enlarge space taken by the structure C, moreover I do not see any ABI acknowledgment for this. 

So, the bitfield allocation strategy looks to be erroneously changed.
>How-To-Repeat:
$g++ foo.cpp
$a.out

Actuall results (output):
sizeof(C) = 24
offsetof(C, d) = 17

Expected results (output):
sizeof(C) = 16
offsetof(C, d) = 13
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the Gcc-bugs mailing list