All of lore.kernel.org
 help / color / mirror / Atom feed
* sparse ignores __attribute__((packed))
@ 2010-08-15 16:15 Bart Van Assche
  2010-08-17  0:20 ` Christopher Li
  0 siblings, 1 reply; 2+ messages in thread
From: Bart Van Assche @ 2010-08-15 16:15 UTC (permalink / raw)
  To: linux-sparse

Hello,

The test program below compiles fine with gcc 4.5.0 but triggers a
build error with sparse (git repository last updated on July 11). This
seems like a sparse bug to me. Is this a known issue ?

#define BUILD_BUG_ON(e) (void)(sizeof(struct { int:-!!(e); }))

struct s {
    char c;
    int i;
} __attribute__((packed));

int main(int argc, char** argv)
{
    BUILD_BUG_ON(sizeof(struct s) != sizeof(char) + sizeof(int));
    return 0;
}

Bart.
--
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: sparse ignores __attribute__((packed))
  2010-08-15 16:15 sparse ignores __attribute__((packed)) Bart Van Assche
@ 2010-08-17  0:20 ` Christopher Li
  0 siblings, 0 replies; 2+ messages in thread
From: Christopher Li @ 2010-08-17  0:20 UTC (permalink / raw)
  To: Bart Van Assche; +Cc: linux-sparse

On Sun, Aug 15, 2010 at 9:15 AM, Bart Van Assche <bvanassche@acm.org> wrote:
> Hello,
>
> The test program below compiles fine with gcc 4.5.0 but triggers a
> build error with sparse (git repository last updated on July 11). This
> seems like a sparse bug to me. Is this a known issue ?

Yes, it is a known issue. Sparse hasn't pay attention to the packed
attribute at all.

Patches are welcome :-)

Chris

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-08-17  0:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-08-15 16:15 sparse ignores __attribute__((packed)) Bart Van Assche
2010-08-17  0:20 ` Christopher Li

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.