Re: Packed struct size issue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[ resending to the correct Sparse email address ].

On Wed, Jul 17, 2019 at 02:42:34PM +0100, John Levon wrote:
> 
> Andy Fiddaman discovered:
> 
> $ cat ./test.c
> #include <stdio.h>
> #include <stdint.h>
> 
> struct t1 {
>         uint8_t                 critical_warning;
>         uint16_t                temperature;
>         uint8_t                 available_spare;
> } __packed;
> 
> _Static_assert(sizeof(struct t1) == 4, "bad size for t1");
> 

I've added Sparse mailing list to the CC.

It looks like the packed attribute is broken on upstream Sparse (from
April) as well and I would prefer if they fixed it and I pulled in their
fix.  It's probably better to use __attribute__((packed)) instead of the
__packed macro in the test code.

regards,
dan carpenter



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux