47035bb8d2
From-SVN: r25770
41 lines
601 B
C
41 lines
601 B
C
/* Spurious uninitialized-variable warnings.
|
|
These cases are documented as not working in the gcc manual. */
|
|
|
|
/* { dg-do compile } */
|
|
/* { dg-options "-O -Wuninitialized" } */
|
|
|
|
extern void use(int);
|
|
extern void foo(void);
|
|
|
|
void
|
|
func1(int cond)
|
|
{
|
|
int x; /* { dg-bogus "x" "uninitialized variable warning" { xfail *-*-* } } */
|
|
|
|
if(cond)
|
|
x = 1;
|
|
|
|
foo();
|
|
|
|
if(cond)
|
|
use(x);
|
|
}
|
|
|
|
void
|
|
func2 (int cond)
|
|
{
|
|
int x; /* { dg-bogus "x" "uninitialized variable warning" { xfail *-*-* } } */
|
|
int flag = 0;
|
|
|
|
if(cond)
|
|
{
|
|
x = 1;
|
|
flag = 1;
|
|
}
|
|
|
|
foo();
|
|
|
|
if(flag)
|
|
use(x);
|
|
}
|