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