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.dg/] [torture/] [pr37868.c] - Blame information for rev 399

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 399 jeremybenn
/* { dg-skip-if "alignment exception" { or32*-*-* } "*" "" } */
5 298 jeremybenn
 
6
extern void abort (void);
7
#if (__SIZEOF_INT__ <= 2)
8
struct X {
9
  unsigned char pad : 4;
10
  unsigned int a : 16;
11
  unsigned int b : 8;
12
  unsigned int c : 6;
13
} __attribute__((packed));
14
#else
15
struct X {
16
  unsigned char pad : 4;
17
  unsigned int a : 32;
18
  unsigned int b : 24;
19
  unsigned int c : 6;
20
} __attribute__((packed));
21
 
22
#endif
23
 
24
 
25
int main (void)
26
{
27
  struct X x;
28
  unsigned int bad_bits;
29
 
30
  x.pad = -1;
31
  x.a = -1;
32
  x.b = -1;
33
  x.c = -1;
34
 
35
  bad_bits = ((unsigned int)-1) ^ *(1+(unsigned int *) &x);
36
  if (bad_bits != 0)
37
    abort ();
38
  return 0;
39
}
40
 

powered by: WebSVN 2.1.0

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