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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [pr51877.c] - Blame information for rev 715

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

Line No. Rev Author Line
1 688 jeremybenn
/* PR tree-optimization/51877 */
2
 
3
extern void abort (void);
4
struct A { int a; char b[32]; } a, b;
5
 
6
__attribute__((noinline, noclone))
7
struct A
8
bar (int x)
9
{
10
  struct A r;
11
  static int n;
12
  r.a = ++n;
13
  __builtin_memset (r.b, 0, sizeof (r.b));
14
  r.b[0] = x;
15
  return r;
16
}
17
 
18
__attribute__((noinline, noclone))
19
void
20
baz (void)
21
{
22
  asm volatile ("" : : : "memory");
23
}
24
 
25
__attribute__((noinline, noclone))
26
void
27
foo (struct A *x, int y)
28
{
29
  if (y == 6)
30
    a = bar (7);
31
  else
32
    *x = bar (7);
33
  baz ();
34
}
35
 
36
int
37
main ()
38
{
39
  a = bar (3);
40
  b = bar (4);
41
  if (a.a != 1 || a.b[0] != 3 || b.a != 2 || b.b[0] != 4)
42
    abort ();
43
  foo (&b, 0);
44
  if (a.a != 1 || a.b[0] != 3 || b.a != 3 || b.b[0] != 7)
45
    abort ();
46
  foo (&b, 6);
47
  if (a.a != 4 || a.b[0] != 7 || b.a != 3 || b.b[0] != 7)
48
    abort ();
49
  return 0;
50
}

powered by: WebSVN 2.1.0

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