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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [20010518-2.c] - Blame information for rev 297

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 297 jeremybenn
/* Mis-aligned packed structures.  */
2
 
3
typedef struct
4
{
5
  char b0;
6
  char b1;
7
  char b2;
8
  char b3;
9
  char b4;
10
  char b5;
11
} __attribute__ ((packed)) b_struct;
12
 
13
 
14
typedef struct
15
{
16
  short a;
17
  long b;
18
  short c;
19
  short d;
20
  b_struct e;
21
} __attribute__ ((packed)) a_struct;
22
 
23
 
24
int
25
main(void)
26
{
27
  volatile a_struct *a;
28
  volatile a_struct b;
29
 
30
  a = &b;
31
  *a = (a_struct){1,2,3,4};
32
  a->e.b4 = 'c';
33
 
34
  if (a->a != 1 || a->b != 2 || a->c != 3 || a->d != 4 || a->e.b4 != 'c')
35
    abort ();
36
 
37
  exit (0);
38
}

powered by: WebSVN 2.1.0

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