Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/gcc.dg/uninit-15.c @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children |
comparison
equal
deleted
inserted
replaced
111:04ced10e8804 | 131:84e7813d76e9 |
---|---|
1 /* PR tree-optimization/17506 | 1 /* PR tree-optimization/17506 |
2 We issue an uninitialized variable warning at a wrong location at | 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 | 3 line 11, which is very confusing. Make sure we print out a note to |
4 make it less confusing. (not xfailed alternative) | 4 make it less confusing. (not xfailed alternative) |
5 But it is of course ok if we warn in bar about uninitialized use | 5 But it is of course ok if we warn in bar about uninitialized use |
6 of j. (xfailed alternative) */ | 6 of j. (not xfailed alternative) */ |
7 /* { dg-do compile } */ | 7 /* { dg-do compile } */ |
8 /* { dg-options "-O1 -Wuninitialized" } */ | 8 /* { dg-options "-O1 -Wuninitialized" } */ |
9 | 9 |
10 inline int | 10 inline int |
11 foo (int i) | 11 foo (int i) |
12 { | 12 { |
13 if (i) /* { dg-warning "used uninitialized in this function" } */ | 13 if (i) /* { dg-warning "used uninitialized in this function" "" } */ |
14 return 1; | 14 return 1; |
15 return 0; | 15 return 0; |
16 } | 16 } |
17 | 17 |
18 void baz (void); | 18 void baz (void); |
19 | 19 |
20 void | 20 void |
21 bar (void) | 21 bar (void) |
22 { | 22 { |
23 int j; /* { dg-message "note: 'j' was declared here" } */ | 23 int j; /* { dg-message "note: 'j' was declared here" "" } */ |
24 for (; foo (j); ++j) /* { dg-warning "'j' is used uninitialized" "" { xfail *-*-* } } */ | 24 for (; foo (j); ++j) /* { dg-warning "'j' is used uninitialized" "" { xfail *-*-* } } */ |
25 baz (); | 25 baz (); |
26 } | 26 } |