| 1 |
// { dg-do run } |
| 2 |
// GROUPS passed bit-fields |
| 3 |
// bitfield file |
| 4 |
// Message-Id: <[email protected]> |
| 5 |
// From: [email protected] (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 <[email protected]> |
| 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 |
// { dg-skip-if "" { 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 |
|