new file mode 100644
@@ -0,0 +1,24 @@
+#define __packed __attribute__((packed))
+
+typedef struct {
+ __INT8_TYPE__ a;
+ __INT16_TYPE__ b;
+ __INT32_TYPE__ c;
+} __packed obj_t;
+
+_Static_assert(sizeof(obj_t) == 7, "sizeof packed struct");
+
+static void foo(obj_t *ptr, int val)
+{
+ ptr->c = val;
+}
+
+static void bar(obj_t o)
+{
+ foo(&o, 0);
+}
+
+/*
+ * check-name: packed-deref0
+ * check-known-to-fail
+ */
new file mode 100644
@@ -0,0 +1,33 @@
+#define __packed __attribute__((packed))
+
+typedef unsigned char u8;
+typedef __UINT16_TYPE__ u16;
+typedef __UINT32_TYPE__ u32;
+typedef __UINT64_TYPE__ u64;
+
+struct a {
+ u8 a;
+ u8 b;
+ u16 c;
+} __packed;
+_Static_assert(__alignof(struct a) == 1, "align struct");
+_Static_assert( sizeof(struct a) == 4, " size struct");
+
+struct b {
+ u32 a;
+ u32 b;
+} __packed;
+_Static_assert(__alignof(struct b) == 1, "align struct");
+_Static_assert( sizeof(struct b) == 8, "size struct");
+
+struct c {
+ u16 a;
+ u32 b;
+} __packed;
+_Static_assert(__alignof(struct c) == 1, "align struct");
+_Static_assert( sizeof(struct c) == 6, "size struct");
+
+/*
+ * check-name: packed-struct
+ * check-known-to-fail
+ */
Currently, packed structs are not handled correctly. Add some testcases for them. Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> --- validation/packed-deref0.c | 24 ++++++++++++++++++++++++ validation/packed-struct.c | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 57 insertions(+) create mode 100644 validation/packed-deref0.c create mode 100644 validation/packed-struct.c