[Buildroot] [autobuild.buildroot.net] Your daily results for 2020-08-18

Arnout Vandecappelle arnout at mind.be
Fri Aug 28 11:17:15 UTC 2020



On 28/08/2020 11:08, Kieran Bingham wrote:
> 	enum ControlType   type_:8;                      /*     0: 0  4 */
> 	/* Bitfield combined with next fields */
> 	bool                       isArray_;             /*     1     1 */
> 	/* Bitfield combined with previous fields */
> 	size_t                     numElements_:32;      /*     0:16  8 */

 So this one is in fact unaligned? Did you never encounter a runtime error on
machines that don't allow unaligned access? Or perhaps gcc generates a different
layout in that case, with the hole before numElements instead of after it...

> 	/* XXX 16 bits hole, try to pack */
> 	union {
> 		uint64_t           value_;               /*     8     8 */
> 		void *             storage_;             /*     8     8 */
> 	};                                               /*     8     8 */

 Having a layout like this in a struct that is ABI is asking for trouble IMO,
because some compile options (e.g. -fpack-struct) will change it. I think you
should add padding fields to make sure alignment is exactly as you expect, and
also give the bool member an explicit size (i.e. make it a bitfield too). The
unaligned field is bad news IMO, but changing that is an ABI change...

 Regards,
 Arnout



More information about the buildroot mailing list