OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.5.1/] [gcc/] [testsuite/] [gcc.dg/] [union-5.c] - Blame information for rev 404

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

Line No. Rev Author Line
1 298 jeremybenn
/* { dg-do run { target i?86-*-* x86_64-*-* } } */
2
/* { dg-options "-O -fgcse -fno-split-wide-types" } */
3
 
4
extern void abort(void);
5
 
6
typedef unsigned short int uint16_t;
7
typedef unsigned int uint32_t;
8
typedef unsigned long long uint64_t;
9
 
10
typedef struct
11
{
12
  uint16_t thread;
13
  uint16_t phase;
14
} s32;
15
 
16
typedef union
17
{
18
  uint32_t i;
19
  s32 s;
20
} u32;
21
 
22
typedef union
23
{
24
  uint64_t i;
25
  u32 u;
26
} u64;
27
 
28
static __attribute__((noinline))
29
void foo(int val)
30
{
31
  u64 data;
32
  uint32_t thread;
33
 
34
  data.u.i = 0x10000L;
35
  thread = data.u.s.thread;
36
  if (val)
37
    abort ();
38
  if (thread)
39
    abort ();
40
}
41
 
42
int main(void)
43
{
44
  foo (0);
45
  return 0;
46
}

powered by: WebSVN 2.1.0

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