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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [warn/] [Wunused-var-5.C] - Blame information for rev 801

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

Line No. Rev Author Line
1 693 jeremybenn
// { dg-do compile }
2
// { dg-options "-Wunused" }
3
 
4
template 
5
void
6
f1 (void)
7
{
8
  int a;        // { dg-warning "set but not used" }
9
  int b;
10
  int c;
11
  c = 1;
12
  a = b = c;
13
}
14
 
15
template 
16
void
17
f2 (int x)
18
{
19
  int a;        // { dg-warning "set but not used" }
20
  int b;
21
  int c;        // { dg-warning "set but not used" }
22
  c = (a = x, b = x);
23
}
24
 
25
template 
26
int
27
f3 (int x)
28
{
29
  int a;
30
  return a = x;
31
}
32
 
33
template 
34
int
35
f4 (int x)
36
{
37
  int a;
38
  a = x;
39
  return a;
40
}
41
 
42
template 
43
void
44
f5 (int x)
45
{
46
  int a[2];     // { dg-warning "set but not used" }
47
  int b;
48
  int *c, d[2];
49
  c = d;
50
  b = x;
51
  a[b] = 1;
52
  c[b] = 1;
53
}
54
 
55
template 
56
int
57
f6 (int x)
58
{
59
  int a[2];
60
  int b;
61
  b = x;
62
  a[b] = 1;
63
  return a[b];
64
}
65
 
66
template 
67
void
68
f7 (int x, int *p)
69
{
70
  int *a[2];
71
  a[x] = p;
72
  a[x][x] = x;
73
}
74
 
75
struct S { int i; };
76
 
77
template 
78
void
79
f8 (void)
80
{
81
  struct S s;   // { dg-warning "set but not used" }
82
  s.i = 6;
83
}
84
 
85
template 
86
int
87
f9 (void)
88
{
89
  struct S s;
90
  s.i = 6;
91
  return s.i;
92
}
93
 
94
template 
95
struct S
96
f10 (void)
97
{
98
  struct S s;
99
  s.i = 6;
100
  return s;
101
}
102
 
103
extern int foo11 (int *);
104
 
105
template 
106
void
107
f11 (void)
108
{
109
  int a[2];
110
  foo11 (a);
111
}
112
 
113
template 
114
void
115
f12 (void)
116
{
117
  int a;
118
  a = 1;
119
  a;    // { dg-warning "statement has no effect" }
120
}
121
 
122
template 
123
void
124
f13 (void (*x) (void))
125
{
126
  void (*a) (void);
127
  a = x;
128
  a ();
129
}
130
 
131
template 
132
void
133
f14 (void (*x) (void))
134
{
135
  void (*a) (void);     // { dg-warning "set but not used" }
136
  a = x;
137
}
138
 
139
extern void foo15 (int *);
140
 
141
template 
142
void
143
f15 (void)
144
{
145
  int a[10];
146
  int *b = a + 2;
147
  foo15 (b);
148
}
149
 
150
extern void foo16 (int **);
151
 
152
template 
153
void
154
f16 (void)
155
{
156
  int a[10];
157
  int *b[] = { a, a + 2 };
158
  foo16 (b);
159
}
160
 
161
template 
162
void
163
f17 (int x)
164
{
165
  long a;       // { dg-warning "set but not used" }
166
  int b;
167
  a = b = x;
168
}
169
 
170
template 
171
void
172
f18 (int x)
173
{
174
  int a;        // { dg-warning "set but not used" }
175
  int b;
176
  a = (char) (b = x);
177
}
178
 
179
template 
180
int
181
f19 (int x, int y, int z)
182
{
183
  int a;
184
  int b;
185
  a = x;
186
  b = y;
187
  return z ? a : b;
188
}
189
 
190
template 
191
int *
192
f20 (int x)
193
{
194
  static int a[] = { 3, 4, 5, 6 };
195
  static int b[] = { 4, 5, 6, 7 };
196
  static int c[] = { 5, 6, 7, 8 };      // { dg-warning "set but not used" }
197
  c[1] = 1;
198
  return x ? a : b;
199
}
200
 
201
S s;
202
 
203
void
204
test ()
205
{
206
  int i = 0;
207
  f1<0> ();
208
  f2<0> (0);
209
  (void) f3<0> (0);
210
  (void) f4<0> (0);
211
  f5<0> (0);
212
  (void) f6<0> (0);
213
  f7<0> (0, &i);
214
  f8<0> ();
215
  (void) f9<0> ();
216
  s = f10<0> ();
217
  f11<0> ();
218
  f12<0> ();
219
  f13<0> (f1<0>);
220
  f14<0> (f1<0>);
221
  f15<0> ();
222
  f16<0> ();
223
  f17<0> (0);
224
  f18<0> (0);
225
  (void) f19<0> (0, 0, 0);
226
  (void) f20<0> (0);
227
}

powered by: WebSVN 2.1.0

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