aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/diagnostic-tree-expr-ranges-2.c
blob: 1cbcad5ac7dde3f9ef9fb7e8317343f31dfc9129 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
/* { dg-do compile } */
/* { dg-options "-Wuninitialized -fdiagnostics-show-caret" } */

int test_uninit_1 (void)
{
  int result_1;     /* { dg-message "declared here" } */
  return result_1;  /* { dg-warning "uninitialized" } */
  /* { dg-begin-multiline-output "" }
   return result_1;
          ^~~~~~~~
   int result_1;
       ^~~~~~~~
   { dg-end-multiline-output "" } */
}

int test_uninit_2 (void)
{
  int result_2;     /* { dg-message "declared here" } */
  result_2 += 3;    /* { dg-warning "uninitialized" } */
  /* { dg-begin-multiline-output "" }
   result_2 += 3;
   ~~~~~~~~~^~~~
   int result_2;
       ^~~~~~~~
   { dg-end-multiline-output "" } */
  return result_2;
}