blob: 2730534e90e39819e81f7353d13c311ca6de66ca (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
/* Positive test for uninitialized variables. */
/* { dg-do compile } */
/* { dg-options "-O -Wuninitialized" } */
int sink;
void f1(int parm) /* { dg-bogus "uninitialized" "parameter" } */
{
sink = parm; /* { dg-bogus "uninitialized" "parameter" } */
}
void f2(void)
{
int x;
sink = x; /* { dg-warning "is used" "unconditional" } */
}
void f3(int p)
{
int x;
if (p)
x = p;
sink = x; /* { dg-warning "may be used" "conditional" } */
}
void f4(int p)
{
int x; /* { dg-bogus "uninitialized" "easy if" } */
if (p)
x = 1;
else
x = 2;
sink = x;
}
void f5(void)
{
int x, i; /* { dg-bogus "uninitialized" "easy loop" } */
for (i = 0; i < 10; ++i)
x = 1;
sink = x;
}
|