annotate gcc/testsuite/gcc.dg/uninit-15.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children 84e7813d76e9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 /* PR tree-optimization/17506
kono
parents:
diff changeset
2 We issue an uninitialized variable warning at a wrong location at
kono
parents:
diff changeset
3 line 11, which is very confusing. Make sure we print out a note to
kono
parents:
diff changeset
4 make it less confusing. (not xfailed alternative)
kono
parents:
diff changeset
5 But it is of course ok if we warn in bar about uninitialized use
kono
parents:
diff changeset
6 of j. (xfailed alternative) */
kono
parents:
diff changeset
7 /* { dg-do compile } */
kono
parents:
diff changeset
8 /* { dg-options "-O1 -Wuninitialized" } */
kono
parents:
diff changeset
9
kono
parents:
diff changeset
10 inline int
kono
parents:
diff changeset
11 foo (int i)
kono
parents:
diff changeset
12 {
kono
parents:
diff changeset
13 if (i) /* { dg-warning "used uninitialized in this function" } */
kono
parents:
diff changeset
14 return 1;
kono
parents:
diff changeset
15 return 0;
kono
parents:
diff changeset
16 }
kono
parents:
diff changeset
17
kono
parents:
diff changeset
18 void baz (void);
kono
parents:
diff changeset
19
kono
parents:
diff changeset
20 void
kono
parents:
diff changeset
21 bar (void)
kono
parents:
diff changeset
22 {
kono
parents:
diff changeset
23 int j; /* { dg-message "note: 'j' was declared here" } */
kono
parents:
diff changeset
24 for (; foo (j); ++j) /* { dg-warning "'j' is used uninitialized" "" { xfail *-*-* } } */
kono
parents:
diff changeset
25 baz ();
kono
parents:
diff changeset
26 }