summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute/bf-pack-1.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.c-torture/execute/bf-pack-1.c')
-rw-r--r--gcc/testsuite/gcc.c-torture/execute/bf-pack-1.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.c-torture/execute/bf-pack-1.c b/gcc/testsuite/gcc.c-torture/execute/bf-pack-1.c
new file mode 100644
index 000000000..ca3b1db76
--- /dev/null
+++ b/gcc/testsuite/gcc.c-torture/execute/bf-pack-1.c
@@ -0,0 +1,23 @@
+struct foo
+{
+ unsigned half:16;
+ unsigned long whole:32 __attribute__ ((packed));
+};
+
+f (struct foo *q)
+{
+ if (q->half != 0x1234)
+ abort ();
+ if (q->whole != 0x56789abcL)
+ abort ();
+}
+
+main ()
+{
+ struct foo bar;
+
+ bar.half = 0x1234;
+ bar.whole = 0x56789abcL;
+ f (&bar);
+ exit (0);
+}