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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [transparent-union-5.c] - Blame information for rev 867

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

Line No. Rev Author Line
1 149 jeremybenn
/* PR 24255 */
2
/* { dg-do run } */
3
/* { dg-options "-O" } */
4
 
5
extern void abort (void);
6
 
7
union wait { int w_status; };
8
 
9
typedef union
10
{
11
  union wait *uptr;
12
  int *iptr;
13
} WAIT_STATUS __attribute__ ((__transparent_union__));
14
 
15
int status;
16
union wait wstatus;
17
 
18
void __attribute__((noinline))
19
test1 (WAIT_STATUS s)
20
{
21
  if (s.iptr != &status)
22
    abort ();
23
}
24
 
25
void __attribute__((noinline))
26
test2 (WAIT_STATUS s)
27
{
28
  if (s.uptr != &wstatus)
29
    abort ();
30
}
31
 
32
int main()
33
{
34
  test1 (&status);
35
  test2 (&wstatus);
36
  return 0;
37
}

powered by: WebSVN 2.1.0

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