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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.c-torture/] [execute/] [20000715-1.c] - Blame information for rev 154

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
void abort(void);
2
void exit(int);
3
 
4
void
5
test1(void)
6
{
7
  int x = 3, y = 2;
8
 
9
  if ((x < y ? x++ : y++) != 2)
10
    abort ();
11
 
12
  if (x != 3)
13
    abort ();
14
 
15
  if (y != 3)
16
    abort ();
17
}
18
 
19
void
20
test2(void)
21
{
22
  int x = 3, y = 2, z;
23
 
24
  z = (x < y) ? x++ : y++;
25
  if (z != 2)
26
    abort ();
27
 
28
  if (x != 3)
29
    abort ();
30
 
31
  if (y != 3)
32
    abort ();
33
}
34
 
35
void
36
test3(void)
37
{
38
  int x = 3, y = 2;
39
  int xx = 3, yy = 2;
40
 
41
  if ((xx < yy ? x++ : y++) != 2)
42
    abort ();
43
 
44
  if (x != 3)
45
    abort ();
46
 
47
  if (y != 3)
48
    abort ();
49
}
50
 
51
int x, y;
52
 
53
static void
54
init_xy(void)
55
{
56
  x = 3;
57
  y = 2;
58
}
59
 
60
void
61
test4(void)
62
{
63
  init_xy();
64
  if ((x < y ? x++ : y++) != 2)
65
    abort ();
66
 
67
  if (x != 3)
68
    abort ();
69
 
70
  if (y != 3)
71
    abort ();
72
}
73
 
74
void
75
test5(void)
76
{
77
  int z;
78
 
79
  init_xy();
80
  z = (x < y) ? x++ : y++;
81
  if (z != 2)
82
    abort ();
83
 
84
  if (x != 3)
85
    abort ();
86
 
87
  if (y != 3)
88
    abort ();
89
}
90
 
91
void
92
test6(void)
93
{
94
  int xx = 3, yy = 2;
95
  int z;
96
 
97
  init_xy();
98
  z = (xx < y) ? x++ : y++;
99
  if (z != 2)
100
    abort ();
101
 
102
  if (x != 3)
103
    abort ();
104
 
105
  if (y != 3)
106
    abort ();
107
}
108
 
109
int
110
main(){
111
  test1 ();
112
  test2 ();
113
  test3 ();
114
  test4 ();
115
  test5 ();
116
  test6 ();
117
  exit (0);
118
}

powered by: WebSVN 2.1.0

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