OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.dg/] [c1x-anon-struct-1.c] - Blame information for rev 801

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 689 jeremybenn
/* Test for anonymous structures and unions in C1X.  */
2
/* { dg-do compile } */
3
/* { dg-options "-std=c1x -pedantic-errors" } */
4
 
5
#include <stddef.h>
6
 
7
struct s1
8
{
9
  int a;
10
  union
11
  {
12
    int i;
13
  };
14
  struct
15
  {
16
    int b;
17
  };
18
};
19
 
20
union u1
21
{
22
  int b;
23
  struct
24
  {
25
    int i;
26
  };
27
  union
28
  {
29
    int c;
30
  };
31
};
32
 
33
struct s2
34
{
35
  struct
36
  {
37
    int a;
38
  };
39
};
40
 
41
struct s3
42
{
43
  union
44
  {
45
    int i;
46
  };
47
};
48
 
49
struct s4
50
{
51
  struct
52
  {
53
    int i;
54
  };
55
  int a[];
56
};
57
 
58
struct s1 x =
59
  {
60
    .b = 1,
61
    .i = 2,
62
    .a = 3
63
  };
64
 
65
int o = offsetof (struct s1, i);
66
 
67
void
68
f (void)
69
{
70
  x.i = 3;
71
  (&x)->i = 4;
72
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.