OSDN Git Service

/
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / g++.old-deja / g++.law / bit-fields2.C
1 // { dg-do run  }
2 // GROUPS passed bit-fields
3 // bitfield file
4 // Message-Id: <92Oct29.191913est.62@jarvis.csri.toronto.edu>
5 // From: mdivax1!robinson@ai.mit.edu (Jim Robinson)
6 // Subject: gcc 2.2.2 C++ bug in handling :0 bit fields
7 // Date:   Thu, 29 Oct 1992 19:18:28 -0500
8 //
9 // Also applies to:
10 // bitfield file
11 // From: Jaimie Wilson/MSL <Jaimie_Wilson@msl.isis.org>
12 // Date:   Fri, 28 Jan 1994 06:11:43 -0500
13 // Subject: GCC bug report
14 //
15 // This test is only meant for targets where EMPTY_FIELD_BOUNDARY is
16 // defined to no larger than the size of an unsigned int, or where
17 // PCC_BITFIELD_TYPE_MATTERS is defined.  Add skips below for targets that
18 // do not have that property.
19 // Skip if target: mmix-knuth-mmixware
20
21
22 #include <stdio.h>
23 #include <stddef.h>
24
25 struct foo {
26         char a;
27         char b;
28         unsigned int : 0;       /* force word alignment */
29         char c;
30 };
31
32 int
33 main(int argc, char **argv)
34 {
35         struct foo bar;
36
37         if (offsetof (struct foo, c) > sizeof (unsigned int))
38                 { printf ("FAIL\n"); return 1; }
39         else
40                 printf ("PASS\n");
41         return 0;
42 }
43