[Bug middle-end/28161] Wrong bit field layout with -mms-bitfields

seongbae dot park at gmail dot com gcc-bugzilla@gcc.gnu.org
Mon Jun 26 20:57:00 GMT 2006



------- Comment #1 from seongbae dot park at gmail dot com  2006-06-26 20:47 -------
I belive this is a bug in stor-layout.c:place_field() around line 10503
bitpos is calculated as bit_offset of rli->prev_field + type size.
However, the prev_field is not really the immediately previous field but the
first field of the consecutive same-sized fields.
Hence, in this case:

struct S
{
  long long d:23;
  int e:32;
  int f:32;
} a;

rli->prev_field is "d" when "field" is f. 
The correct fix should calculate the bitpos as 
rli->bitpos + type size.


-- 

seongbae dot park at gmail dot com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |seongbae dot park at gmail
                   |                            |dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28161



More information about the Gcc-bugs mailing list