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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-stable/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [torture/] [pr37868.c] - Blame information for rev 298

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

Line No. Rev Author Line
1 298 jeremybenn
/* { dg-do run } */
2
/* { dg-options "-fno-strict-aliasing" } */
3
/* { dg-skip-if "unaligned access" { sparc*-*-* } "*" "" } */
4
 
5
extern void abort (void);
6
#if (__SIZEOF_INT__ <= 2)
7
struct X {
8
  unsigned char pad : 4;
9
  unsigned int a : 16;
10
  unsigned int b : 8;
11
  unsigned int c : 6;
12
} __attribute__((packed));
13
#else
14
struct X {
15
  unsigned char pad : 4;
16
  unsigned int a : 32;
17
  unsigned int b : 24;
18
  unsigned int c : 6;
19
} __attribute__((packed));
20
 
21
#endif
22
 
23
 
24
int main (void)
25
{
26
  struct X x;
27
  unsigned int bad_bits;
28
 
29
  x.pad = -1;
30
  x.a = -1;
31
  x.b = -1;
32
  x.c = -1;
33
 
34
  bad_bits = ((unsigned int)-1) ^ *(1+(unsigned int *) &x);
35
  if (bad_bits != 0)
36
    abort ();
37
  return 0;
38
}
39
 

powered by: WebSVN 2.1.0

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