public inbox for smatch@vger.kernel.org
 help / color / mirror / Atom feed
From: John Levon <levon@movementarian.org>
To: smatch@vger.kernel.org
Cc: andy@omniosce.org
Subject: Packed struct size issue
Date: Wed, 17 Jul 2019 14:42:34 +0100	[thread overview]
Message-ID: <20190717134234.GA5551@movementarian.org> (raw)


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

             reply	other threads:[~2019-07-17 14:57 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-17 13:42 John Levon [this message]
2019-07-18 10:16 ` Packed struct size issue Dan Carpenter
2019-07-18 10:50 ` Dan Carpenter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190717134234.GA5551@movementarian.org \
    --to=levon@movementarian.org \
    --cc=andy@omniosce.org \
    --cc=smatch@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox