From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from userp2130.oracle.com ([156.151.31.86]:32954 "EHLO userp2130.oracle.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726608AbfGRKRX (ORCPT ); Thu, 18 Jul 2019 06:17:23 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=corp-2018-07-02; bh=Q37Ug02R8g2BPDcN+gVUb5XKTTgYmq3Br1V23L6e8aM=; b=lRTYPcv9uOpyJQfqUE5zSxy/Y4xQsuaJYpdBLncbwooCbgTRxq14rxAQ2Nv8Lhr4j4yr eFf6YMKa0xNZbLhln/a8WMVKackrMUR+1mv3Re/ewmrPS9ZgnjCo0rS7BvJ6etpprOfF zBWdS57K65Sf+E9RvT9pC4AlxBj2DBwkqXedV73tuB9sfq782zYnaNjrxUfVGODdkcgd PO8SnPItdxgUMYyZZgW/yB59r2HyN2FZwQYW6zVUUT9ID1zSyTaKqKhfw+R8kmX1AroT BFOiuOrMpPHOxFa335yuTmOs5vUpfuYzsYaAyDKSbWvEMzFsxK94dCbnMAEFmVfO1Xi0 hA== Date: Thu, 18 Jul 2019 13:16:34 +0300 From: Dan Carpenter Subject: Re: Packed struct size issue Message-ID: <20190718093322.GD3111@kadam> References: <20190717134234.GA5551@movementarian.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190717134234.GA5551@movementarian.org> Sender: smatch-owner@vger.kernel.org List-ID: To: John Levon Cc: smatch@vger.kernel.org, andy@omniosce.org, sparse@vger.kernel.org On Wed, Jul 17, 2019 at 02:42:34PM +0100, John Levon wrote: > > Andy Fiddaman discovered: > > $ cat ./test.c > #include > #include > > 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