]> git.ipfire.org Git - thirdparty/gcc.git/blame - gcc/testsuite/gcc.dg/uninit-15.c
* passes.def (pass_early_thread_jumps): Schedule after forwprop.
[thirdparty/gcc.git] / gcc / testsuite / gcc.dg / uninit-15.c
CommitLineData
c6f1d124 1/* PR tree-optimization/17506
2 We issue an uninitialized variable warning at a wrong location at
3 line 11, which is very confusing. Make sure we print out a note to
a18b7a33 4 make it less confusing. (not xfailed alternative)
c6f1d124 5 But it is of course ok if we warn in bar about uninitialized use
a18b7a33 6 of j. (xfailed alternative) */
25084579 7/* { dg-do compile } */
c6f1d124 8/* { dg-options "-O1 -Wuninitialized" } */
25084579 9
c6f1d124 10inline int
11foo (int i)
25084579 12{
a18b7a33 13 if (i) /* { dg-warning "used uninitialized in this function" } */
c6f1d124 14 return 1;
15 return 0;
25084579 16}
17
c6f1d124 18void baz (void);
25084579 19
c6f1d124 20void
21bar (void)
25084579 22{
a18b7a33 23 int j; /* { dg-message "note: 'j' was declared here" } */
24 for (; foo (j); ++j) /* { dg-warning "'j' is used uninitialized" "" { xfail *-*-* } } */
c6f1d124 25 baz ();
25084579 26}