This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] fix PR 27948


A regression was noticed in the case where a zero length bitfield followed immediately after a bitfield that is the full length of the underlying type, e.g. :

struct foo
{
   char a : 8;
   int :0;
}

Tracked it down to this change. I also made sure to enable the existing bitfield tests as well as putting in another testcase based on the fix. I didn't enable bf-ms-attrib.c because I think the testcase is incorrect. According to the docs that i put into gcc (and tested exhaustively with MS) the struct:

struct foo {
   int d;
   unsigned char a;
   unsigned short b:7;
   char c;
}

when compiled with ms_struct should be of size 8, not the 12 in the testcase. There's no packing occuring and the final structure size doesn't need to be padded because the size is already a multiple of 4 (the size of the largest element in the record).

Bootstrapped and regression tested on x86-darwin.

OK?

-eric

2006-06-09 Eric Christopher <echristo@apple.com>

	* config/stor-layout.c (place_field): Remove check for
	remaining_in_alignment when aligning at the end of
	a run.

2006-06-09 Eric Christopher <echristo@apple.com>

	* gcc.dg/bf-no-ms-layout.c: Enable for i?86-darwin.
	* gcc.dg/bf-ms-layout.c: Ditto. Use attribute instead of
	command line option.
	* gcc.dg/attr-ms_struct-2.c: New.


Attachment: bitfield.diff.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]