Powered by Linux
Re: Packed struct size issue — Semantic Matching Tool

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]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux