Debian Codegraph @

gcc/testsuite/gcc.dg/20020527-1.c

raw
1 /* PR c/6660
2 Test whether an unnamed field with user defined type - struct or union is
3 accepted. */
4 /* { dg-do compile } */
5 /* { dg-options "-fms-extensions" } */
6
7 typedef struct {
8 unsigned short a;
9 unsigned short b;
10 } __attribute__ ((__packed__)) A;
11
12 typedef struct B_ {
13 unsigned int c;
14 unsigned int d;
15 } B;
16
17 typedef struct C_ {
18 B;
19 unsigned int e;
20 unsigned int f;
21 } C;
22
23 typedef C D;
24
25 typedef struct {
26 A;
27 D;
28 struct {
29 unsigned short g;
30 unsigned short h;
31 } __attribute__ ((__packed__));
32 union {
33 int i;
34 long j;
35 };
36 int k;
37 } __attribute__ ((__packed__)) E;
38
39 E x;
40
41 void foo (void)
42 {
43 x.a = 1;
44 x.b = 2;
45 x.c = 3;
46 x.d = 4;
47 x.e = 5;
48 x.f = 6;
49 x.g = 7;
50 x.h = 8;
51 x.i = 9;
52 x.j = 10;
53 x.k = 11;
54 }