| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-Wuninitialized -fdiagnostics-show-caret" } */ |
| 3 |
|
| 4 |
int test_uninit_1 (void) |
| 5 |
{ |
| 6 |
int result_1; /* { dg-message "declared here" } */ |
| 7 |
return result_1; /* { dg-warning "uninitialized" } */ |
| 8 |
/* { dg-begin-multiline-output "" } |
| 9 |
return result_1; |
| 10 |
^~~~~~~~ |
| 11 |
int result_1; |
| 12 |
^~~~~~~~ |
| 13 |
{ dg-end-multiline-output "" } */ |
| 14 |
} |
| 15 |
|
| 16 |
int test_uninit_2 (void) |
| 17 |
{ |
| 18 |
int result_2; /* { dg-message "declared here" } */ |
| 19 |
result_2 += 3; /* { dg-warning "uninitialized" } */ |
| 20 |
/* { dg-begin-multiline-output "" } |
| 21 |
result_2 += 3; |
| 22 |
~~~~~~~~~^~~~ |
| 23 |
int result_2; |
| 24 |
^~~~~~~~ |
| 25 |
{ dg-end-multiline-output "" } */ |
| 26 |
return result_2; |
| 27 |
} |