Packed struct size issue
John Levon <[email protected]>
| Newsgroups | org.kernel.vger.smatch |
|---|---|
| Message-ID | <[email protected]> |
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");
struct t2 {
uint8_t critical_warning;
uint16_t temperature;
uint8_t available_spare;
};
_Static_assert(sizeof(struct t2) == 6, "bad size for t2");
$ ./smatch ./test.c
./test.c:10:34: error: static assertion failed: "bad size for t1"
Looks like we lost this commit:
https://github.com/illumos/smatch/commit/0c60237e4096b7576f0aec21a7545026c7041611#diff-0cd054d23ed9e02274eaa540fc7e6536
??
This works:
https://github.com/citrus-it/illumos-omnios/commit/88e29e1705a616695ec6f905c3cab1f600e12659?diff=unified
regards
john